• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua 7.6 PvP Arena

Northnorial

Member
Joined
May 30, 2009
Messages
742
Reaction score
5
Location
Germany
I got this script for a pvp arena
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?
 
Well the pvp zone thingy is working, but the player who dies in that zone is being teleported to the temple.

I'd like to teleport the player next to the arena, hows that possible?
 
You could add that it teleports back to the arena, for example with addEvent.
Code:
addEvent(doTeleportThing, 1, cid, arena.exit)
 
Back
Top