I have this script where the loser is teleported when you die inside the arena ,
I would like to make the winner also be teleported out saying he won?
I would like to make the winner also be teleported out saying he won?
Code:
local arena = {
frompos = {x = 97, y = 36, z = 9},
topos = {x = 109, y = 47, z = 9},
exitpos = {x = 93, y = 40, z = 8}
}
function onPrepareDeath(player, lastHitKiller, mostDamageKiller)
if player:isPlayer() then
local ppos = player:getPosition()
if isInRange(ppos, arena.frompos, arena.topos) then
local maxhp = player:getMaxHealth()
player:addHealth(maxhp)
addEvent(doCreatureAddHealth, 100, player:getId(), maxhp)
player:sendTextMessage(MESSAGE_STATUS_WARNING,"[Arena]: You lost the duel.")
end
if isInRange(ppos, arena.frompos, arena.topos) then
player:teleportTo(arena.exitpos)
return true
end
end
return true
end
function onLogin(player)
player:registerEvent("pvparena")
return true
end