Testa ai manolo:
function loseOnZombieArena(cid)
kickPlayerFromZombiesArea(cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOOM! Você está morto.")
local players = getZombiesEventPlayers()
if(#players <= 1) then
local winner = players[1]
local items = {2160, 7958, 2352, 12610}
if(winner) then
doPlayerAddItem(cid,items[math.random(1,#items)], math.random(1, 100))
doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "Você Ganhou o Evento Zombie !!! Parabéns.")
doBroadcastMessage("After " .. os.time() - getPlayerZombiesEventStatus(winner) .. " segundos de evento " .. getCreatureName(winner) .. " você ganhou o Evento Zombie contra " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zombies !!!")
kickPlayerFromZombiesArea(winner)
else
doBroadcastMessage("Zombie Evento Acabou !!! Não teve vencedor ?!?!?! Como Assim ?")
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)
local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
centerPos.z = z
for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
if(isMonster(uid)) then
doRemoveCreature(uid)
end
end
end
end
end
function onStatsChange(target, cid, changetype, combat, value)
if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then
doCreatureAddHealth(target, getCreatureMaxHealth(target))
loseOnZombieArena(target)
return false
end
return true
end







info
Grupo: Artesão
Registrado: 07/04/12
Posts: 139
Reputação: +4
Queria ao invés de os itens recebidos fossem fixo, queria que desse ele no sistema de Random para cada hora que um vencer ganhar diferentes itens aleatoriamente.
SCRIPT
function loseOnZombieArena(cid)
kickPlayerFromZombiesArea(cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOOM! Você está morto.")
local players = getZombiesEventPlayers()
if(#players <= 1) then
local winner = players[1]
if(winner) then
doPlayerAddItem(winner, 2160, 100, true)
doPlayerAddItem(winner, 7958, 100, true)
doPlayerAddItem(winner, 2352, 100, true)
doPlayerAddItem(winner, 12610, 100, true)
doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "Você Ganhou o Evento Zombie !!! Parabéns.")
doBroadcastMessage("After " .. os.time() - getPlayerZombiesEventStatus(winner) .. " segundos de evento " .. getCreatureName(winner) .. " você ganhou o Evento Zombie contra " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zombies !!!")
kickPlayerFromZombiesArea(winner)
else
doBroadcastMessage("Zombie Evento Acabou !!! Não teve vencedor ?!?!?! Como Assim ?")
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)
local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
centerPos.z = z
for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
if(isMonster(uid)) then
doRemoveCreature(uid)
end
end
end
end
end
function onStatsChange(target, cid, changetype, combat, value)
if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then
doCreatureAddHealth(target, getCreatureMaxHealth(target))
loseOnZombieArena(target)
return false
end
return true
end