Hello guys, need some help!
I wonder if its possible out of this script to make a function that shows how many players that are still alive in the zombie arena.
For every player who dies it should come up a text for example: 5 players left
I wonder if its possible out of this script to make a function that shows how many players that are still alive in the zombie arena.
For every player who dies it should come up a text for example: 5 players left
Code:
local temple = {x=1000, y=1000, z=7}
local t = {
items = {2514, 2472, 2470, 7405, 7453},
exp = 15000000
}
local from = {x = 923, y = 763, z =7}
local to = {x = 953, y = 780, z=7}
local function f(cid)
doTeleportThing(cid, temple)
doSendMagicEffect(temple, CONST_ME_TELEPORT)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), CONST_ME_MAGIC_BLUE, TEXTCOLOR_BLUE, true)
end
function onPrepareDeath(cid, deathList)
if isInRange(getThingPos(cid), from, to) then
if isMonster(deathList[1]) and getCreatureName(deathList[1]):lower() == 'deadly zombie' then
local n = 0
for x = from.x, to.x do
for y = from.y, to.y do
local f = getTopCreature({x=x, y=y, z=from.z}).uid
if f ~= 0 and isPlayer(f) then
n = n + 1
end
end
end
if n == 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you won! Enjoy your reward!')
doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) ..' won Deadly Zombie arena event! This event is over, next event will start in 2 hours.', MESSAGE_EVENT_ADVANCE)
if math.random(15) == 1 then
doPlayerAddExp(cid, t.exp)
else
doPlayerAddItem(cid, t.items[math.random(#t.items)], 1)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You got owned!')
doBroadcastMessage(getCreatureName(cid) .. ' got owned and was kicked from arena.', MESSAGE_EVENT_ADVANCE)
end
elseif isPlayer(deathList[1]) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You got owned by playa!')
end
f(cid)
return false
end
return true
end