Northnorial
Member
I got this script for a pvp arena
The problem is my server does not seem to have a onPrepareDeath function...
is there an alternative to that?
Code:
local arena = {
frompos = {x=1037, y=1037, z=5},
topos = {x=1045, y=1043, z=5},
exit = {x=1041, y=1033, z=5}
}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
if isPlayer(cid) == TRUE then
if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
if doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE) == TRUE then
if doTeleportThing(cid, arena.exit) == TRUE then
doSendMagicEffect(arena.exit, CONST_ME_ENERGYAREA)
doPlayerSendTextMessage(mostDamageKiller,MESSAGE_STATUS_CONSOLE_BLUE, "You have defeated " .. getPlayerName(cid) .. "!")
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, "You were defeated by " .. getPlayerName(mostDamageKiller) .. "!")
return FALSE
end
end
end
end
return TRUE
end
The problem is my server does not seem to have a onPrepareDeath function...
is there an alternative to that?