Northnorial
Member
I found this script here on OtLand and modified it a little, but it's not completely working...
Although both players are level 8 0r higher it keeps telling me the doPlayerSendCancel
Edit: Also I'd like the script to check if theres somebody inside the arena
Code:
local config = {
oldpos = {
{x=1034,y=1032,z=5},
{x=1034,y=1034,z=5}
},
newpos = {
{x=1037,y=1040,z=5},
{x=1045,y=1040,z=5}
},
level = 8,
}
function onUse(cid, item, pos)
if item.itemid == 1946 then
doTransformItem(item.uid, 1945)
else
doTransformItem(item.uid, 1946)
end
local p = {}
for i,v in ipairs(config.oldpos) do
local pid = getTopCreature(v).uid
if pid == 0 or not isPlayer(pid) then
doPlayerSendCancel(cid, "You need 2 players to enter the arena.")
return TRUE
end
table.insert(p, pid)
end
if getPlayerLevel(config.oldpos[i]) >= config.level then
for i,v in ipairs(p) do
doSendMagicEffect(config.oldpos[i], CONST_ME_POFF)
doTeleportThing(v, config.newpos[i], false)
doSendAnimatedText(config.newpos[i], "Fight!", TEXTCOLOR_RED)
doSendMagicEffect(config.newpos[i], CONST_ME_ENERGYAREA)
end
else
doPlayerSendCancel(cid, "Both players have to be level " .. config.level .. " or higher .")
end
return TRUE
end
Although both players are level 8 0r higher it keeps telling me the doPlayerSendCancel
Edit: Also I'd like the script to check if theres somebody inside the arena