blurryshadow1 Posted March 19, 2011 Share Posted March 19, 2011 i downloaded the gangwar [rus] from the resources section of mta's website and currently im in the process of translating it to english.. ok so well the thing is, when you die from gun shots, explosions, and falling off high places it glitches you up and it wont respawn you... when that happens i get this error ERROR: login\spawn_panel_s.lua:119: attempt to preform arithmetic on a boolean value can somebody help me fix it please? if you need the code here it is... ----------//\\----------- ---//GangWar gamemode by SpawN\\--- ----------\\//----------- --//Ñîçäà¸ì êîìàíäû áàíä Grove_Street = createTeam("Grove Street", 0, 179, 4) --setTeamFriendlyFire(Grove_Street , false) Ballas = createTeam("Ballas", 211, 0, 174) --setTeamFriendlyFire(Ballas , false) Aztec = createTeam("Aztec", 0, 219, 222) --setTeamFriendlyFire(Aztec , false) LSPD = createTeam("LSPD", 100, 149, 237) --setTeamFriendlyFire(LSPD , false) --//Òàáëèöà ðåñïàâíîâ. Respawns = {["Grove Street"] = {2498.6701660156, -1684.5754394531, 13.416213035583}, ["Ballas"] = {2172.3395996094, -1794.5, 13.361840248108}, ["Aztec"] = {1828.4742431641, -1682.5, 13.546875} ,["LSPD"] = {1579.728515625, -1635.6196289063, 13.560563087463}} Weapons1 = {} Weapons2 = {} Weapons3 = {} blipPlayers = {} --//Ñïàâí èãðîêà. function playerSpawn(GangName, SkinID, WeaponSlot1, WeaponSlot2, WeaponSlot3) spawnPlayer(source, Respawns[GangName][1],Respawns[GangName][2],Respawns[GangName][3], 0, SkinID, 0, 0) setPlayerTeam(source, getTeamFromName(GangName)) fadeCamera(source, true) setCameraTarget(source, source) if WeaponSlot1 then giveWeapon(source, WeaponSlot1, 350, true) Weapons1[getPlayerName(source)] = WeaponSlot1 end if WeaponSlot2 then giveWeapon(source, WeaponSlot2, 250, true) Weapons2[getPlayerName(source)] = WeaponSlot2 end if WeaponSlot3 then giveWeapon(source, WeaponSlot3, 50, false) Weapons3[getPlayerName(source)] = WeaponSlot3 end setPlayerMoney(source, getAccountData(getPlayerAccount(source),"money")) setPlayerNametagText(source, getPlayerName(source).."["..getElementData(source,"id").."]") local r,g,b = getTeamColor(getTeamFromName(GangName)) blipPlayers[getPlayerName(source)] = createBlipAttachedTo(source, 0, 3, r, g, b, 255, 0, 99999.0)--//Ïðèêëåèâàåì ê èãðîêó áëèï(èêîíêó), ïîä öâåò êîìàíäû. showPlayerHudComponent(source,"radar", true) showPlayerHudComponent(source,"area_name", true) for i = 69,79 do setPedStat(source, i, 999) end end addEvent("playerSpawn", true) addEventHandler("playerSpawn", getRootElement(), playerSpawn) --//Ðåñïàâí èãðîêà ïîñëå ñìåðòè. function RespawnPlayer(source, skin) local teamNeme = getTeamName(getPlayerTeam(source)) spawnPlayer(source, Respawns[teamNeme][1],Respawns[teamNeme][2],Respawns[teamNeme][3], 0, skin, 0, 0) if Weapons1[getPlayerName(source)] then giveWeapon(source, Weapons1[getPlayerName(source)], 350, true) end if Weapons2[getPlayerName(source)] then giveWeapon(source, Weapons2[getPlayerName(source)], 250, true) end if Weapons3[getPlayerName(source)] then giveWeapon(source, Weapons3[getPlayerName(source)], 50, false) end if (isPedHeadless(source) == true) then--//Äîáîâëÿåì èãðîêó ãîëîâó åñëå å¸ íåò. setPedHeadless(source, false) end end --//Ðåñïàâí èãðîêà ïîñëå ñìåðòè. function respawnDead(ammo, attacker, weapon, bodypart) if attacker then if (getElementType(attacker) == "player") then setPlayersStatsIFattackerPlayer(source, attacker) elseif (getElementType(attacker) == "vehicle") then setPlayersStatsIFattackerVehicle(source, attacker) end end if (getElementData(source,"F4") == false) then setTimer(RespawnPlayer, 5000, 1, source, getPlayerSkin(source)) elseif (getElementData(source,"F4") == true) then setTimer(triggerClientEvent, 5000, 1, "step1gangs", source) setElementData(source,"F4", false) end end addEventHandler("onPlayerWasted", getRootElement(), respawnDead) --//Óäîëÿåì ïðè ðåñïàâíå àâòîìîáèëÿ, äàííóþ î òîì êòî â íå¸ ñòðåëÿë, â ðåçóëüòàòå ÷åãî îíà âçîðâàëàñü. playersDamageVihecle = {}--//Òàáëèöà Àòàêóåùèõ àâòîìîáèëåé (åñëå ïîñëå íèõ òà÷êà çàãàðåëàñü). function onVehicleRespawn(exploded) if (getElementType(source) == "vehicle") then if playersDamageVihecle[source] then playersDamageVihecle[source] = nil if not playersDamageVihecle[source] then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933 Ýòó ìàøèóí óáðàëè ñ ìàñèâà, òðàíñïîðò âçîðâàíûé èãðîêàìè.!", getRootElement(), 0, 0, 0,true) end end end end addEventHandler("onVehicleRespawn", getRootElement(), onVehicleRespawn) --//Ôóíêöèÿ èçñåíÿþùÿÿ ñòàòèñòèêó èãðîêîâ. Óìåðøåãî è óáèéöû.(Åñëå àòàêóþùèé èãðîê) function setPlayersStatsIFattackerPlayer(HitPlayer, attacker) local accountAttacker = getPlayerAccount(attacker) local accountHitPlayer = getPlayerAccount(HitPlayer) setAccountData(accountHitPlayer, "Deaths", getAccountData(accountHitPlayer, "Deaths")+1) if (attacker ~= HitPlayer) then --//Åñëè ýòî íå ñàìîóáèéñòâî. setAccountData(accountAttacker, "Kills", getAccountData(accountAttacker, "Kills")+1) givePlayerMoney(attacker, 500) takePlayerMoney(HitPlayer, 500) end end --//Ôóíêöèÿ ñðîáàòûâàþùÿÿ êîãäà èãðîê, çàäàâëåí òà÷êîé. function setPlayersStatsIFattackerVehicle(HitPlayer, vehicle) local theAttacker = getVehicleOccupant(vehicle, 0) if (theAttacker) then setAccountData(getPlayerAccount(HitPlayer), "Deaths", getAccountData(getPlayerAccount(HitPlayer), "Deaths")+1) setAccountData(getPlayerAccount(theAttacker), "Kills", getAccountData(getPlayerAccount(theAttacker), "Kills")+1) takePlayerMoney(HitPlayer, 500) givePlayerMoney(theAttacker, 500) else setAccountData(getPlayerAccount(HitPlayer), "Deaths", getAccountData(getPlayerAccount(HitPlayer), "Deaths")+1) end end function quitPlayer() local playername = getPlayerName(source) destroyElement(blipPlayers[playername])--//Óäîëÿåì áëèï îáîçíà÷àþùèé ìåñòîïîëîæåíèå èãðîêà íà ðàäàðå. local theAccount = getPlayerAccount(source) setAccountData(theAccount, "money", getPlayerMoney(source)) end addEventHandler("onPlayerQuit", getRootElement(), quitPlayer) --//Áèíäèì êëàâèøó F4 function joinplayerBindkey() bindKey(source,"F4", "down", nextGang) end addEventHandler("onPlayerJoin",getRootElement(),joinplayerBindkey) --//F4 ñìåíà êîìàíäû. Ïîñëå ñìåðòè. function nextGang(player, key, keyState) if (getElementData(player,"F4") == false) or (not getElementData(player,"F4")) then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933Âû âêëþ÷èëè âûõîä â ìåíþ âûáîðà áàíäû, ïîñëå ñìåðòè.", player, 0, 0, 0,true) setElementData(player,"F4", true) elseif (getElementData(player,"F4") == true) then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933Âû âûêëþ÷èëè âûõîä â ìåíþ âûáîðà áàíäû, ïîñëå ñìåðòè.", player, 0, 0, 0,true) setElementData(player,"F4", false) end end function quitPlayer() local playername = getPlayerName(source) destroyElement(blipPlayers[playername])--//Óäîëÿåì áëèï îáîçíà÷àþùèé ìåñòîïîëîæåíèå èãðîêà íà ðàäàðå. local theAccount = getPlayerAccount(source) setAccountData(theAccount, "money", getPlayerMoney(source)) end addEventHandler("onPlayerQuit", getRootElement(), quitPlayer) --//Áèíäèì êëàâèøó F4 function joinplayerBindkey() bindKey(source,"F4", "down", nextGang) end addEventHandler("onPlayerJoin",getRootElement(),joinplayerBindkey) Link to comment
Castillo Posted March 19, 2011 Share Posted March 19, 2011 (edited) ----------//\\----------- ---//GangWar gamemode by SpawN\\--- ----------\\//----------- --//Ñîçäà¸ì êîìàíäû áàíä Grove_Street = createTeam("Grove Street", 0, 179, 4) --setTeamFriendlyFire(Grove_Street , false) Ballas = createTeam("Ballas", 211, 0, 174) --setTeamFriendlyFire(Ballas , false) Aztec = createTeam("Aztec", 0, 219, 222) --setTeamFriendlyFire(Aztec , false) LSPD = createTeam("LSPD", 100, 149, 237) --setTeamFriendlyFire(LSPD , false) --//Òàáëèöà ðåñïàâíîâ. Respawns = {["Grove Street"] = {2498.6701660156, -1684.5754394531, 13.416213035583}, ["Ballas"] = {2172.3395996094, -1794.5, 13.361840248108}, ["Aztec"] = {1828.4742431641, -1682.5, 13.546875} ,["LSPD"] = {1579.728515625, -1635.6196289063, 13.560563087463}} Weapons1 = {} Weapons2 = {} Weapons3 = {} blipPlayers = {} --//Ñïàâí èãðîêà. function playerSpawn(GangName, SkinID, WeaponSlot1, WeaponSlot2, WeaponSlot3) spawnPlayer(source, Respawns[GangName][1],Respawns[GangName][2],Respawns[GangName][3], 0, SkinID, 0, 0) setPlayerTeam(source, getTeamFromName(GangName)) fadeCamera(source, true) setCameraTarget(source, source) if WeaponSlot1 then giveWeapon(source, WeaponSlot1, 350, true) Weapons1[getPlayerName(source)] = WeaponSlot1 end if WeaponSlot2 then giveWeapon(source, WeaponSlot2, 250, true) Weapons2[getPlayerName(source)] = WeaponSlot2 end if WeaponSlot3 then giveWeapon(source, WeaponSlot3, 50, false) Weapons3[getPlayerName(source)] = WeaponSlot3 end setPlayerMoney(source, getAccountData(getPlayerAccount(source),"money")) setPlayerNametagText(source, getPlayerName(source).."["..getElementData(source,"id").."]") local r,g,b = getTeamColor(getTeamFromName(GangName)) blipPlayers[getPlayerName(source)] = createBlipAttachedTo(source, 0, 3, r, g, b, 255, 0, 99999.0)--//Ïðèêëåèâàåì ê èãðîêó áëèï(èêîíêó), ïîä öâåò êîìàíäû. showPlayerHudComponent(source,"radar", true) showPlayerHudComponent(source,"area_name", true) for i = 69,79 do setPedStat(source, i, 999) end end addEvent("playerSpawn", true) addEventHandler("playerSpawn", getRootElement(), playerSpawn) --//Ðåñïàâí èãðîêà ïîñëå ñìåðòè. function RespawnPlayer(source, skin) local teamNeme = getTeamName(getPlayerTeam(source)) spawnPlayer(source, Respawns[teamNeme][1],Respawns[teamNeme][2],Respawns[teamNeme][3], 0, skin, 0, 0) if Weapons1[getPlayerName(source)] then giveWeapon(source, Weapons1[getPlayerName(source)], 350, true) end if Weapons2[getPlayerName(source)] then giveWeapon(source, Weapons2[getPlayerName(source)], 250, true) end if Weapons3[getPlayerName(source)] then giveWeapon(source, Weapons3[getPlayerName(source)], 50, false) end if (isPedHeadless(source) == true) then--//Äîáîâëÿåì èãðîêó ãîëîâó åñëå å¸ íåò. setPedHeadless(source, false) end end --//Ðåñïàâí èãðîêà ïîñëå ñìåðòè. function respawnDead(ammo, attacker, weapon, bodypart) if attacker then if (getElementType(attacker) == "player") then setPlayersStatsIFattackerPlayer(source, attacker) elseif (getElementType(attacker) == "vehicle") then setPlayersStatsIFattackerVehicle(source, attacker) end end if (getElementData(source,"F4") == false) then setTimer(RespawnPlayer, 5000, 1, source, getPlayerSkin(source)) elseif (getElementData(source,"F4") == true) then setTimer(triggerClientEvent, 5000, 1, "step1gangs", source) setElementData(source,"F4", false) end end addEventHandler("onPlayerWasted", getRootElement(), respawnDead) --//Óäîëÿåì ïðè ðåñïàâíå àâòîìîáèëÿ, äàííóþ î òîì êòî â íå¸ ñòðåëÿë, â ðåçóëüòàòå ÷åãî îíà âçîðâàëàñü. playersDamageVihecle = {}--//Òàáëèöà Àòàêóåùèõ àâòîìîáèëåé (åñëå ïîñëå íèõ òà÷êà çàãàðåëàñü). function onVehicleRespawn(exploded) if (getElementType(source) == "vehicle") then if playersDamageVihecle[source] then playersDamageVihecle[source] = nil if not playersDamageVihecle[source] then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933 Ýòó ìàøèóí óáðàëè ñ ìàñèâà, òðàíñïîðò âçîðâàíûé èãðîêàìè.!", getRootElement(), 0, 0, 0,true) end end end end addEventHandler("onVehicleRespawn", getRootElement(), onVehicleRespawn) --//Ôóíêöèÿ èçñåíÿþùÿÿ ñòàòèñòèêó èãðîêîâ. Óìåðøåãî è óáèéöû.(Åñëå àòàêóþùèé èãðîê) function setPlayersStatsIFattackerPlayer(HitPlayer, attacker) local accountAttacker = getPlayerAccount(attacker) local accountHitPlayer = getPlayerAccount(HitPlayer) if getAccountData(accountHitPlayer,"Deaths") then setAccountData(accountHitPlayer, "Deaths", tonumber(getAccountData(accountHitPlayer, "Deaths"))+1) else setAccountData(accountHitPlayer, "Deaths",1) end if (attacker ~= HitPlayer) then --//Åñëè ýòî íå ñàìîóáèéñòâî. if getAccountData(accountAttacker,"Kills") then setAccountData(accountAttacker, "Kills", tonumber(getAccountData(accountAttacker, "Kills"))+1) else setAccountData(accountAttacker, "Kills",1) end givePlayerMoney(attacker, 500) takePlayerMoney(HitPlayer, 500) end end --//Ôóíêöèÿ ñðîáàòûâàþùÿÿ êîãäà èãðîê, çàäàâëåí òà÷êîé. function setPlayersStatsIFattackerVehicle(HitPlayer, vehicle) local theAttacker = getVehicleOccupant(vehicle, 0) if (theAttacker) then setAccountData(getPlayerAccount(HitPlayer), "Deaths", getAccountData(getPlayerAccount(HitPlayer), "Deaths")+1) setAccountData(getPlayerAccount(theAttacker), "Kills", getAccountData(getPlayerAccount(theAttacker), "Kills")+1) takePlayerMoney(HitPlayer, 500) givePlayerMoney(theAttacker, 500) else setAccountData(getPlayerAccount(HitPlayer), "Deaths", getAccountData(getPlayerAccount(HitPlayer), "Deaths")+1) end end function quitPlayer() local playername = getPlayerName(source) destroyElement(blipPlayers[playername])--//Óäîëÿåì áëèï îáîçíà÷àþùèé ìåñòîïîëîæåíèå èãðîêà íà ðàäàðå. local theAccount = getPlayerAccount(source) setAccountData(theAccount, "money", getPlayerMoney(source)) end addEventHandler("onPlayerQuit", getRootElement(), quitPlayer) --//Áèíäèì êëàâèøó F4 function joinplayerBindkey() bindKey(source,"F4", "down", nextGang) end addEventHandler("onPlayerJoin",getRootElement(),joinplayerBindkey) --//F4 ñìåíà êîìàíäû. Ïîñëå ñìåðòè. function nextGang(player, key, keyState) if (getElementData(player,"F4") == false) or (not getElementData(player,"F4")) then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933Âû âêëþ÷èëè âûõîä â ìåíþ âûáîðà áàíäû, ïîñëå ñìåðòè.", player, 0, 0, 0,true) setElementData(player,"F4", true) elseif (getElementData(player,"F4") == true) then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933Âû âûêëþ÷èëè âûõîä â ìåíþ âûáîðà áàíäû, ïîñëå ñìåðòè.", player, 0, 0, 0,true) setElementData(player,"F4", false) end end function quitPlayer() local playername = getPlayerName(source) destroyElement(blipPlayers[playername])--//Óäîëÿåì áëèï îáîçíà÷àþùèé ìåñòîïîëîæåíèå èãðîêà íà ðàäàðå. local theAccount = getPlayerAccount(source) setAccountData(theAccount, "money", getPlayerMoney(source)) end addEventHandler("onPlayerQuit", getRootElement(), quitPlayer) --//Áèíäèì êëàâèøó F4 function joinplayerBindkey() bindKey(source,"F4", "down", nextGang) end addEventHandler("onPlayerJoin",getRootElement(),joinplayerBindkey) Try it. Edited March 19, 2011 by Guest Link to comment
blurryshadow1 Posted March 19, 2011 Author Share Posted March 19, 2011 ----------//\\----------- ---//GangWar gamemode by SpawN\\--- ----------\\//----------- --//Ñîçäà¸ì êîìàíäû áàíä Grove_Street = createTeam("Grove Street", 0, 179, 4) --setTeamFriendlyFire(Grove_Street , false) Ballas = createTeam("Ballas", 211, 0, 174) --setTeamFriendlyFire(Ballas , false) Aztec = createTeam("Aztec", 0, 219, 222) --setTeamFriendlyFire(Aztec , false) LSPD = createTeam("LSPD", 100, 149, 237) --setTeamFriendlyFire(LSPD , false) --//Òàáëèöà ðåñïàâíîâ. Respawns = {["Grove Street"] = {2498.6701660156, -1684.5754394531, 13.416213035583}, ["Ballas"] = {2172.3395996094, -1794.5, 13.361840248108}, ["Aztec"] = {1828.4742431641, -1682.5, 13.546875} ,["LSPD"] = {1579.728515625, -1635.6196289063, 13.560563087463}} Weapons1 = {} Weapons2 = {} Weapons3 = {} blipPlayers = {} --//Ñïàâí èãðîêà. function playerSpawn(GangName, SkinID, WeaponSlot1, WeaponSlot2, WeaponSlot3) spawnPlayer(source, Respawns[GangName][1],Respawns[GangName][2],Respawns[GangName][3], 0, SkinID, 0, 0) setPlayerTeam(source, getTeamFromName(GangName)) fadeCamera(source, true) setCameraTarget(source, source) if WeaponSlot1 then giveWeapon(source, WeaponSlot1, 350, true) Weapons1[getPlayerName(source)] = WeaponSlot1 end if WeaponSlot2 then giveWeapon(source, WeaponSlot2, 250, true) Weapons2[getPlayerName(source)] = WeaponSlot2 end if WeaponSlot3 then giveWeapon(source, WeaponSlot3, 50, false) Weapons3[getPlayerName(source)] = WeaponSlot3 end setPlayerMoney(source, getAccountData(getPlayerAccount(source),"money")) setPlayerNametagText(source, getPlayerName(source).."["..getElementData(source,"id").."]") local r,g,b = getTeamColor(getTeamFromName(GangName)) blipPlayers[getPlayerName(source)] = createBlipAttachedTo(source, 0, 3, r, g, b, 255, 0, 99999.0)--//Ïðèêëåèâàåì ê èãðîêó áëèï(èêîíêó), ïîä öâåò êîìàíäû. showPlayerHudComponent(source,"radar", true) showPlayerHudComponent(source,"area_name", true) for i = 69,79 do setPedStat(source, i, 999) end end addEvent("playerSpawn", true) addEventHandler("playerSpawn", getRootElement(), playerSpawn) --//Ðåñïàâí èãðîêà ïîñëå ñìåðòè. function RespawnPlayer(source, skin) local teamNeme = getTeamName(getPlayerTeam(source)) spawnPlayer(source, Respawns[teamNeme][1],Respawns[teamNeme][2],Respawns[teamNeme][3], 0, skin, 0, 0) if Weapons1[getPlayerName(source)] then giveWeapon(source, Weapons1[getPlayerName(source)], 350, true) end if Weapons2[getPlayerName(source)] then giveWeapon(source, Weapons2[getPlayerName(source)], 250, true) end if Weapons3[getPlayerName(source)] then giveWeapon(source, Weapons3[getPlayerName(source)], 50, false) end if (isPedHeadless(source) == true) then--//Äîáîâëÿåì èãðîêó ãîëîâó åñëå å¸ íåò. setPedHeadless(source, false) end end --//Ðåñïàâí èãðîêà ïîñëå ñìåðòè. function respawnDead(ammo, attacker, weapon, bodypart) if attacker then if (getElementType(attacker) == "player") then setPlayersStatsIFattackerPlayer(source, attacker) elseif (getElementType(attacker) == "vehicle") then setPlayersStatsIFattackerVehicle(source, attacker) end end if (getElementData(source,"F4") == false) then setTimer(RespawnPlayer, 5000, 1, source, getPlayerSkin(source)) elseif (getElementData(source,"F4") == true) then setTimer(triggerClientEvent, 5000, 1, "step1gangs", source) setElementData(source,"F4", false) end end addEventHandler("onPlayerWasted", getRootElement(), respawnDead) --//Óäîëÿåì ïðè ðåñïàâíå àâòîìîáèëÿ, äàííóþ î òîì êòî â íå¸ ñòðåëÿë, â ðåçóëüòàòå ÷åãî îíà âçîðâàëàñü. playersDamageVihecle = {}--//Òàáëèöà Àòàêóåùèõ àâòîìîáèëåé (åñëå ïîñëå íèõ òà÷êà çàãàðåëàñü). function onVehicleRespawn(exploded) if (getElementType(source) == "vehicle") then if playersDamageVihecle[source] then playersDamageVihecle[source] = nil if not playersDamageVihecle[source] then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933 Ýòó ìàøèóí óáðàëè ñ ìàñèâà, òðàíñïîðò âçîðâàíûé èãðîêàìè.!", getRootElement(), 0, 0, 0,true) end end end end addEventHandler("onVehicleRespawn", getRootElement(), onVehicleRespawn) --//Ôóíêöèÿ èçñåíÿþùÿÿ ñòàòèñòèêó èãðîêîâ. Óìåðøåãî è óáèéöû.(Åñëå àòàêóþùèé èãðîê) function setPlayersStatsIFattackerPlayer(HitPlayer, attacker) local accountAttacker = getPlayerAccount(attacker) local accountHitPlayer = getPlayerAccount(HitPlayer) if getAccountData(accountHitPlayer,"Deaths") then setAccountData(accountHitPlayer, "Deaths", getAccountData(accountHitPlayer, "Deaths")+1) else setAccountData(accountHitPlayer, "Deaths",1) end if (attacker ~= HitPlayer) then --//Åñëè ýòî íå ñàìîóáèéñòâî. if getAccountData(accountHitPlayer,"Kills") then setAccountData(accountAttacker, "Kills", getAccountData(accountAttacker, "Kills")+1) else setAccountData(accountAttacker, "Kills",1) end givePlayerMoney(attacker, 500) takePlayerMoney(HitPlayer, 500) end end --//Ôóíêöèÿ ñðîáàòûâàþùÿÿ êîãäà èãðîê, çàäàâëåí òà÷êîé. function setPlayersStatsIFattackerVehicle(HitPlayer, vehicle) local theAttacker = getVehicleOccupant(vehicle, 0) if (theAttacker) then setAccountData(getPlayerAccount(HitPlayer), "Deaths", getAccountData(getPlayerAccount(HitPlayer), "Deaths")+1) setAccountData(getPlayerAccount(theAttacker), "Kills", getAccountData(getPlayerAccount(theAttacker), "Kills")+1) takePlayerMoney(HitPlayer, 500) givePlayerMoney(theAttacker, 500) else setAccountData(getPlayerAccount(HitPlayer), "Deaths", getAccountData(getPlayerAccount(HitPlayer), "Deaths")+1) end end function quitPlayer() local playername = getPlayerName(source) destroyElement(blipPlayers[playername])--//Óäîëÿåì áëèï îáîçíà÷àþùèé ìåñòîïîëîæåíèå èãðîêà íà ðàäàðå. local theAccount = getPlayerAccount(source) setAccountData(theAccount, "money", getPlayerMoney(source)) end addEventHandler("onPlayerQuit", getRootElement(), quitPlayer) --//Áèíäèì êëàâèøó F4 function joinplayerBindkey() bindKey(source,"F4", "down", nextGang) end addEventHandler("onPlayerJoin",getRootElement(),joinplayerBindkey) --//F4 ñìåíà êîìàíäû. Ïîñëå ñìåðòè. function nextGang(player, key, keyState) if (getElementData(player,"F4") == false) or (not getElementData(player,"F4")) then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933Âû âêëþ÷èëè âûõîä â ìåíþ âûáîðà áàíäû, ïîñëå ñìåðòè.", player, 0, 0, 0,true) setElementData(player,"F4", true) elseif (getElementData(player,"F4") == true) then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933Âû âûêëþ÷èëè âûõîä â ìåíþ âûáîðà áàíäû, ïîñëå ñìåðòè.", player, 0, 0, 0,true) setElementData(player,"F4", false) end end function quitPlayer() local playername = getPlayerName(source) destroyElement(blipPlayers[playername])--//Óäîëÿåì áëèï îáîçíà÷àþùèé ìåñòîïîëîæåíèå èãðîêà íà ðàäàðå. local theAccount = getPlayerAccount(source) setAccountData(theAccount, "money", getPlayerMoney(source)) end addEventHandler("onPlayerQuit", getRootElement(), quitPlayer) --//Áèíäèì êëàâèøó F4 function joinplayerBindkey() bindKey(source,"F4", "down", nextGang) end addEventHandler("onPlayerJoin",getRootElement(),joinplayerBindkey) Try it. unfortunatly its still the same outcome... except i found a few more problems too sadly... pretty much everything that consists of gaining higher deaths or kills on the scoreboard can give you this little error... Link to comment
Castillo Posted March 19, 2011 Share Posted March 19, 2011 Copy the code again, i've edited it. Link to comment
blurryshadow1 Posted March 19, 2011 Author Share Posted March 19, 2011 okay edit: it works ... well i havent got to testing every different situation of getting killed but the situations where you die from explosions and falling from the sky works edit 2: one other problem now... the deaths and kills dont reset back to 0 when you leave the server it just adds on each time you visit... Link to comment
Moderators Citizen Posted March 19, 2011 Moderators Share Posted March 19, 2011 edit 2: one other problem now... the deaths and kills dont reset back to 0 when you leave the server it just adds on each time you visit... Try this ( replace Kills by the good elementData if it's wrong ): function resetKills() -- Set his kills to 0 ( I think it's a setElementData so ...) setElementData( source, "Kills", 0 ) end addEventHandler( "onPlayerConnect", getRootElement(), resetKills ) Link to comment
blurryshadow1 Posted March 19, 2011 Author Share Posted March 19, 2011 edit 2: one other problem now... the deaths and kills dont reset back to 0 when you leave the server it just adds on each time you visit... Try this ( replace Kills by the good elementData if it's wrong ): function resetKills() -- Set his kills to 0 ( I think it's a setElementData so ...) setElementData( source, "Kills", 0 ) end addEventHandler( "onPlayerConnect", getRootElement(), resetKills ) i dont think its working... i just added this onto the .lua file snake posted up there... Link to comment
proracer Posted March 19, 2011 Share Posted March 19, 2011 Why can't you simply use onPlayerJoin instead of onPlayerConnect? Link to comment
Castillo Posted March 20, 2011 Share Posted March 20, 2011 edit 2: one other problem now... the deaths and kills dont reset back to 0 when you leave the server it just adds on each time you visit... Try this ( replace Kills by the good elementData if it's wrong ): function resetKills() -- Set his kills to 0 ( I think it's a setElementData so ...) setElementData( source, "Kills", 0 ) end addEventHandler( "onPlayerConnect", getRootElement(), resetKills ) Citizen, onPlayerConnect is when a player connects, this should use onPlayerJoin instead. function resetKills() -- Set his kills to 0 ( I think it's a setElementData so ...) setElementData( source, "Kills", 0 ) end addEventHandler( "onPlayerJoin", getRootElement(), resetKills ) Link to comment
blurryshadow1 Posted March 20, 2011 Author Share Posted March 20, 2011 edit 2: one other problem now... the deaths and kills dont reset back to 0 when you leave the server it just adds on each time you visit... Try this ( replace Kills by the good elementData if it's wrong ): function resetKills() -- Set his kills to 0 ( I think it's a setElementData so ...) setElementData( source, "Kills", 0 ) end addEventHandler( "onPlayerConnect", getRootElement(), resetKills ) Citizen, onPlayerConnect is when a player connects, this should use onPlayerJoin instead. function resetKills() -- Set his kills to 0 ( I think it's a setElementData so ...) setElementData( source, "Kills", 0 ) end addEventHandler( "onPlayerJoin", getRootElement(), resetKills ) i dont know if its me not putting in the code right or the script but for some reason it still doesnt work.. Link to comment
Moderators Citizen Posted March 20, 2011 Moderators Share Posted March 20, 2011 Sorry my bad ( I don't know why but I didn't see the script ) so it's not setElementData but setAccountData: function resetKills() local theAccount = getPlayerAccount(source) setAccountData(theAccount, "Kills", 0 ) end addEventHandler( "onPlayerJoin", getRootElement(), resetKills ) Link to comment
blurryshadow1 Posted March 20, 2011 Author Share Posted March 20, 2011 Sorry my bad ( I don't know why but I didn't see the script )so it's not setElementData but setAccountData: function resetKills() local theAccount = getPlayerAccount(source) setAccountData(theAccount, "Kills", 0 ) end addEventHandler( "onPlayerJoin", getRootElement(), resetKills ) it still doesnt work... that alright guys i guess i can live without the kills reseting..... i realized that money saves too so if deaths and kills didnt save it would be a little un even... you know? well thanks guys for trying.. edit: !!!!!!!!!!! I FIXED IT!!!!! i changed OnPlayerJoin to OnplayerLogin!!!! :D Link to comment
Castillo Posted March 21, 2011 Share Posted March 21, 2011 lol, that was obiously, if you want to use setAccountData you can't use onPlayerJoin because when the player joins he/she is not logged in Link to comment
blurryshadow1 Posted March 21, 2011 Author Share Posted March 21, 2011 lol, that was obiously, if you want to use setAccountData you can't use onPlayerJoin because when the player joins he/she is not logged in ahhh i see... well at least now i know how to reset things like money,deaths, and kills.. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now