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

Request Script or help fix this one

Keiro

New Member
Joined
Jun 24, 2009
Messages
285
Reaction score
0
Look, the idea is, 3 players stay on a sqm, then they are tped to a quest, but if there is ppl already on the quest, then they wont be able to use the switch.

i have this script , but smth is wrong , it always enter the " if t == 0 or not isPlayer(t) then" , i noticed t is always 0, but positions are correct, i checked and re checked....so i dont understand why t keeps being 0, so that way it will keep entering that if


thanks you.



Lua:
 -- Quest level 40 by Rama v 1.0 --
local from={x=1199, y=1050, z=8}
local to={x=1254, y=1104, z=8}
 
local playerA={
    {x=1118, y=1043, z=10},
    {x=1118, y=1044, z=10},
    {x=1118, y=1045, z=10}
}
local playerB={
    {x=1243, y=1088, z=8},
    {x=1244, y=1088, z=8},
    {x=1242, y=1088, z=8}
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local t = {}
    if item.itemid == 1945 then
        for i = 1, 3 do
 
            t[i]=getTopCreature(playerA[i]).uid
            if t[i] == 0 or not isPlayer(t[i]) then
 
                return doPlayerSendCancel(cid, 'You need 3 players for this quest.')
            elseif getPlayerLevel(t[i]) < 40 then
                return doPlayerSendCancel(cid, 'All players need to have level 40 or higher.')
            end
        end
        for i = 1, 3 do
            doTeleportThing(t[i], playerB[i])
            doSendMagicEffect(playerA[i], CONST_ME_POFF)
            doSendMagicEffect(playerB[i], CONST_ME_ENERGYAREA)
        end
    else
        for x = from.x, to.x do
            for y = from.y, to.y do
                local v = getTopCreature({x=x, y=y, z=from.z}).uid
                if v ~= 0 and isPlayer(v) then
                    return doPlayerSendCancel(cid, 'There is already a team in the quest room.')
                end
            end
        end
    end
    return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top