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

Solved Action not working

Northnorial

Member
Joined
May 30, 2009
Messages
742
Reaction score
5
Location
Germany
I found this script here on OtLand and modified it a little, but it's not completely working...

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
 
Maybe if you change:
Code:
if getPlayerLevel(config.oldpos[i]) >= config.level then

to:
Code:
if getPlayerLevel(p[1]) >= config.level and getPlayerLevel(p[2]) >= config.level  then
 
Back
Top