• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

LEVER WITH TIMEOUT. (REQUEST)

Vitich

Member
Joined
Nov 28, 2012
Messages
266
Reaction score
11
Hi everyone.

I want a script that pull a lever and remove x wall, and after 30 min/1 hour wall back again automatically.

Thank you!
 
Why u ppl can't use tags or correct title like: [TFS 1.x] (Action) Lever with TIMEOUT.
Tfs ver?
I have something like this, tfs 1.x:
LUA:
local wallPosition = Position(1000, 1000, 7) --wall position
local wall = 1028 --wall ID
local revertTime = 1 * 60 * 1000 --time: 1=1min

local function revertWall()
    Game.createItem(wall, 1, wallPosition)
    wallPosition:sendMagicEffect(CONST_ME_POFF)
end

local function revertLever(position)
    local leverItem = Tile(position):getItemById(1946)
    if leverItem then
        leverItem:transform(1945)
    end
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 1945 then
        local removeWall = Tile(wallPosition):getItemById(wall)
        if removeWall then
            removeWall:remove()
            wallPosition:sendMagicEffect(CONST_ME_POFF)
            addEvent(revertWall, revertTime)
        end

        item:transform(1946)
        addEvent(revertLever, revertTime, toPosition)
    end
    return true
end

 
Back
Top