• 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!

TFS 1.X+ how to add more arenas properly

Manigold

Active Member
Joined
Nov 2, 2017
Messages
198
Solutions
8
Reaction score
48
I need help to add more arenas,and don't know the right way to add, this is my arena script
**EDIT = I clicked to post before I finished writing ,sorry for that ;P
Lua:
function onLogin(cid)
cid:registerEvent("Arena_Death")
return true
end

local arena = {
     from = {x=121, y=33, z=10}, -- left top corner of  arena
     to = {x=128, y=37, z=10}, -- right bottom corner of  arena
     temple = { x = 125, y = 31, z = 9 } -- change it to exit pos

     }
  
  
  
function onPrepareDeath(cid, killer)
    if isInRange(getPlayerPosition(cid), arena.from,arena.to) then
        if isPlayer(cid) then

            cid:sendTextMessage(MESSAGE_STATUS_WARNING,"[PVP Arena]: You have been defeated by " .. getCreatureName(killer,cid) .. ". You sux.")
            Player(cid):addHealth(Player(cid):getMaxHealth())
            Player(cid):teleportTo(arena.temple, true)
            Player(killer):sendTextMessage(MESSAGE_STATUS_WARNING,"[PVP Arena]: You have defeated " .. getCreatureName(cid,killer) .. ". You are the best Fighter.")
            Player(killer):addHealth(Player(cid):getMaxHealth())
            Player(killer):teleportTo(arena.temple, true)
            return false
        end
    end
   return true
end

function isInRange(pos, fromPos, toPos)
   return pos.x >= fromPos.x and pos.y >= fromPos.y and pos.z >= fromPos.z and pos.x <= toPos.x and pos.y <= toPos.y and pos.z <= toPos.z
end
 
Last edited:
Solution
S
copy the same script with different name and register it in creaturescripts.xml and change the positions from pos = top lefft corner , to pos = bottom right corner and don't forget to register in login.lua as the first script is added
copy the same script with different name and register it in creaturescripts.xml and change the positions from pos = top lefft corner , to pos = bottom right corner and don't forget to register in login.lua as the first script is added
 
Last edited by a moderator:
Solution
Back
Top