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

Lever Transfers Tile

God Sallonzo

New Member
Joined
Feb 17, 2008
Messages
124
Reaction score
2
Location
The Netherlands
Can someone make a script for 8.60

That makes you pull a lever and it will then transform a ground tile into a stair

And after 10 seconds it will turn back to the ground tile

So you have to pull it again

Thanks
 
Try this out.
Code:
local t = {
    -- location of the stairs to spawn
    stairPosition = {x = 0, y = 0, z = 0},
    -- staircase id
    stairId = 1385,
    -- switches used
    switchIds = {[1945] = 1946, [1946] = 1945},
    seconds = 10
    
}

local function removeStairs(t)
    local stairs = getTileItemById(t.stairPosition, t.stairId).uid
    -- do stairs exist?
    if stairs then
        -- if they do remove them
        doRemoveItem(stairs)
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    -- if there is no staircase present lets continue
    if getTileItemById(t.stairPosition, t.stairId).uid == 0 then
        -- lets not make it important to know which state the switch is in
        if t.switchIds[item.itemid] then
            -- transform the switch
            doTransformItem(item.uid, t.switchIds[item.itemid])
            -- create the stairs
            doCreateItem(t.stairId, 1, t.stairPosition)
            -- execute the removeStairs function in 10 seconds and pass the whole table
            addEvent(removeStairs, t.seconds * 1000, t)
        end
    end
    return true
end
 
Back
Top