Code:
local arena = {
frompos = {x=121, y=36, z=9}, -- Top Left Corner
topos = {x=131, y=43, z=9}, -- Bottom Right Corner
exit = {x=126, y=33, z=9} -- Where loser goes
}
local tpPos = {x=126, y=36, z=9} -- Create Teleport Here
local exit = {x=126, y=33, z=9} -- Where Tele Takes You
local function remTp(pos)
local tp = getTileItemById(pos, 1387).uid
if tp >0 then
doRemoveItem(tp)
end
end
function onPrepareDeath(cid, deathList)
for i = 1, cid do
if isPlayer(cid) == TRUE then
if isInArea(getCreaturePosition(cid), arena.frompos, arena.topos) then
if doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid) ) then
if doCreatureCheck(cid, getCreatureHealth(cid) < 0 ) then
doTeleportThing(cid, arena.exit)
doSendMagicEffect(arena.exit, 10)
doCreateTeleport(1387, exit, tpPos)
addEvent(remTp, 10 * 1000, exit)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE ,'[ARENA] Round over!')
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, '[ARENA] Come in again!')
return TREU
end
return TRUE
end
return TRUE
end
return TRUE
end
end
end
When player 1 or 2 has 0 HP normaly will be kicked to exitPos.
But it dont work and stay in arena with 0 HP.
This error appears in console:
Code:
[28/11/2009 17:23:06] data/creaturescripts/scripts/arena3.lua:21: attempt to call global 'doCreatureCheck' (a nil value)
[28/11/2009 17:23:06] stack traceback:
[28/11/2009 17:23:06] data/creaturescripts/scripts/arena3.lua:21: in function <data/creaturescripts/scripts/arena3.lua:16>
[28/11/2009 17:23:07] Lua Script Error: [CreatureScript Interface]
[28/11/2009 17:23:07] data/creaturescripts/scripts/arena3.lua:onPrepareDeath
[28/11/2009 17:23:07] data/creaturescripts/scripts/arena3.lua:21: attempt to call global 'doCreatureCheck' (a nil value)
[28/11/2009 17:23:07] stack traceback:
[28/11/2009 17:23:07] data/creaturescripts/scripts/arena3.lua:21: in function <data/creaturescripts/scripts/arena3.lua:16>
[28/11/2009 17:23:07] Lua Script Error: [CreatureScript Interface]
[28/11/2009 17:23:07] data/creaturescripts/scripts/arena3.lua:onPrepareDeath
[28/11/2009 17:23:07] data/creaturescripts/scripts/arena3.lua:21: attempt to call global 'doCreatureCheck' (a nil value)
[28/11/2009 17:23:08] stack traceback:
[28/11/2009 17:23:08] data/creaturescripts/scripts/arena3.lua:21: in function <data/creaturescripts/scripts/arena3.lua:16>
Ah... and the created tpPos wont dissappear.
pls fix