local rew = { 10137, 10141, 10063 } function loseOnZombieArena(cid) kickPlayerFromZombiesArea(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOOM! You are dead.") local players = getZombiesEventPlayers() if(#players <= 1) then local winner = players[1] if(winner) then local r = rew[math.random(#rew)] db.executeQuery('INSERT INTO zombie VALUES(NULL, ' .. getPlayerGUID(winner) .. ', ' .. r .. ', ' .. getStorage(ZE_ZOMBIES_SPAWNED) .. ', ' .. os.time() .. ', ' .. os.time() - getPlayerZombiesEventStatus(winner) .. ')') doPlayerAddItem(winner, r, 1) local it = getItemInfo(r) doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "You won zombies arena event. The reward was " .. it.article .. " " .. it.name .. ".") doBroadcastMessage("After " .. os.time() - getPlayerZombiesEventStatus(winner) .. " seconds of fight " .. getCreatureName(winner) .. " won Zombie Arena Event in game versus " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zombies!") kickPlayerFromZombiesArea(winner) else doBroadcastMessage("Zombie arena event finished! No one win?!?!?! WTF!") end doSetStorage(ZE_STATUS, 0) doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS) doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0) doSetStorage(ZE_ZOMBIES_SPAWNED, 0) for x = 1078, 1127 do for y = 1230, 1262 do local c = getTopCreature({x=x, y=y, z=15}).uid if c ~= 0 and isMonster(c) then doRemoveCreature(c) end end end end end function onStatsChange(cid, attacker, type, combat, value) if isMonster(attacker) and getCreatureName(attacker) == "Zombie Event" then doCreatureAddHealth(cid, getCreatureMaxHealth(cid)) loseOnZombieArena(cid) return false elseif (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and isInRange(getThingPosition(cid), {x=1078, y=1230, z=15}, {x=1230, y=1263, z=15}) then return false end return true end