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

Getting switches to reset

Status
Not open for further replies.

Xaiman

New Member
Joined
Feb 27, 2010
Messages
94
Reaction score
0
Im using zyntax's lever riddle script yet i can get the switchs to reset and for the teleporter to go away.

Code:
local config = {
                switches = {
                            [1] = {pos = {x=239, y=78, z=1, stackpos=1}},
                            [2] = {pos = {x=240, y=78, z=1, stackpos=1}},
                            [3] = {pos = {x=241, y=78, z=1, stackpos=1}},
                            [4] = {pos = {x=242, y=78, z=1, stackpos=1}}
                           },
                correct = {
                            [1] = {id = 1946},
                            [2] = {id = 1945},
                            [3] = {id = 1945},
                            [4] = {id = 1946}
                          },
                teleporter = 1387,
                telepos = {x=244, y=79, z=1, stackpos=1},
                teleto = {x=252, y=86, z=3},
                check = {
                         [1] = false,
                         [2] = false,
                         [3] = false,
                         [4] = false
                        },
               }
local resettime = 30000

local function reset(item)
    for k, v in pairs(config.switches) do
        if getThingFromPos(config.switches[k].pos).itemid == 1946 then
            doTransformItem(item.uid, 1945)
        end
    end
end

function onStepIn(cid, item, pos, fromPos)

    if isPlayer(cid) == TRUE then
        for i = 1, #config.switches do
            if getThingFromPos(config.switches[i].pos).itemid == config.correct[i].id then
                config.check[i] = true
            else
                config.check[i] = false
            end
        end
        
        if (config.check[1] and config.check[2] and config.check[3] and config.check[4]) == true then
            setItemAttr(doCreateTeleport(config.teleporter, config.teleto, config.telepos), "aid", 9001)
            doPlayerSay(cid, 'Congratulations '..getPlayerName(cid)..'!\nYou solved the lever riddle!', 19)
            addEvent(reset, resettime, item)
        else
            doPlayerSay(cid, 'Fail.', 19)
        end
    end
    return true
end
Otlanders arent to helpfull :>
 
Last edited by a moderator:
local resettime = 30000

local function reset(item)
for k, v in pairs(config.switches) do
if getThingFromPos(config.switches[k].pos).itemid == 1946 then
doTransformItem(item.uid, 1945)
end
end
end

Code:
local resettime = 30000

local function reset(item)
    for k, v in pairs(config.switches) do
        if getThingFromPos(config.switches[k].pos).itemid == 1946 then
            doTransformItem(item.uid, 1945)
        end
    end
 return true
end
Im not sure but try to add return true
 
really REALLY REALLY would LOVE help with this lol. my server is opening tomorrow and i need this to work.

Close this thread, i made it in a different way.
 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top