Hugofasima
Website: thenosegang.servegame.com
- Joined
- Jun 24, 2015
- Messages
- 206
- Reaction score
- 23
Hello everyone!! Need help heere Pleeaaase Guys!!
What I'm doing wrong??? My script is stopping at third if when I compare 2 game storages.
I know I'm doing something really wrong, is my first script!
What I'm doing wrong??? My script is stopping at third if when I compare 2 game storages.
Code:
dofile('data/war-field.lua')
function onPrepareDeath(player, lastHitKiller, mostDamageKiller)
local specs = Game.getSpectators(waitingRoomCenterPos, false, onlyPlayers, 0, waitingRoomRadiusX, 0, waitingRoomRadiusY)
local ppos = player:getPosition()
print("onPrepareDeath loaded") --[[ OK! Load :))))]]
if player:isPlayer() then
print("isPlayer loaded") --[[ OK! Load :))))]]
if isInRange(ppos, warFieldFromPos, warFieldToPos) then
print("isInRange loaded") --[[ OK! Load :))))]]
if (Game.getStorageValue(countBlueDeaths) < fragsToWin and Game.getStorageValue(countRedDeaths) < fragsToWin) then
print("Compare storages loaded") --[[ DIDN'T LOAD!! :((((( ]]
if player:getStorageValue(joinedBlueStorage) == 1 then
Game.setStorageValue(countBlueDeaths, Game.getStorageValue(countBlueDeaths)+1)
if isInRange(ppos, warFieldFromPos, warFieldToPos) then
player:teleportTo(redBasePos)
return true
end
addEvent(doCreatureAddHealth, 100, player:getId(), maxhp)
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have died during the rush event! Blue Score ['.. countBlueDeaths ..'/'.. fragsToWin ..'] | Red Score ['..countRedDeaths..'/'.. fragsToWin..']')
else
Game.setStorageValue(countRedDeaths, Game.getStorageValue(countRedDeaths)+1)
if isInRange(ppos, warFieldFromPos, warFieldToPos) then
player:teleportTo(blueBasePos)
return true
end
addEvent(doCreatureAddHealth, 100, player:getId(), maxhp)
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have died during the rush event! Red Score ['.. countRedDeaths ..'/'.. fragsToWin ..'] | Blue Score ['..countBlueDeaths..'/'.. fragsToWin..']')
end
elseif Game.getStorageValue(countBlueDeaths) >= fragsToWin then
for i = 1, #specs do
if specs[i]:getStorageValue(joinedBlueStorage) == 1 then
specs[i]:addItem(2400, 1, true, 1, CONST_SLOT_WHEREEVER)
else
specs[i]:addItem(2400, 1, true, 1, CONST_SLOT_WHEREEVER)
end
end
endWarField()
-- bluewin
else
for i = 1, #specs do
if specs[i]:getStorageValue(joinedRedStorage) == 1 then
specs[i]:addItem(2400, 1, true, 1, CONST_SLOT_WHEREEVER)
else
specs[i]:addItem(2400, 1, true, 1, CONST_SLOT_WHEREEVER)
end
end
endWarField()
-- redwin
end
end
end
return true
end
function onLogin(player)
print("register warfieldDeath loaded") --[[ OK! Load :))))]]
player:registerEvent("WarfieldDeath")
return true
end
I know I'm doing something really wrong, is my first script!
Last edited: