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

[REQUEST] Lever removes wall with timer

Grehy

Killroy
Joined
Nov 21, 2008
Messages
2,631
Reaction score
33
Location
United States
I have a script I found on here, but the post was kind of old, so I'm guessing it needs fixed or I need a new one. I get no console errors, the script just doesn't do anything.

Code:
function createWall()
local wallPos = {x=1001, y=406, z=8, stackpos=1} -- Position of the wall
    doCreateItem(1304, 1, wallPos) -- Replace 1112 to the ID of your wall
    end

function onUse(cid, item, frompos, item2, topos)
local config = {
        removeMessage = "Think it worked?", -- Message when you remove the wall
        createMessage = "Think it worked?", -- Message when you create the wall
        wallPos = {x=1001, y=406, z=8, stackpos=1}, -- Position of the wall
        switchUID = 2300, -- Unique ID of the switch
        timer = 1*60*1000 -- After how long time the wall should be created again after using the switch 
        }
            
local getWall = getThingFromPos(config.wallPos)
    if item.uid == switchUID then
        doRemoveItem(getWall.uid, 1)
        doPlayerSendTextMessage(cid, 19, config.removeMessage)
        doTransformItem(item.uid, item.itemid+1)
        addEvent(createWall, config.timer)
    end  
end

I'll rep, thanks!
 
this should work:

LUA:
local config = 
{
        removeMessage = "Think it worked?", -- Message when you remove the wall
        wallPos = {x=1001, y=406, z=8, stackpos=1}, -- Position of the wall
        switchUID = 2300, -- Unique ID of the switch
        timer = 1*60*1000 -- After how long time the wall should be created again after using the switch 
}

function createWall()
    doCreateItem(1304, 1, config.wallPos) -- Replace 1112 to the ID of your wall
  return TRUE  
end

function onUse(cid, item, frompos, item2, topos)
            
local getWall = getThingFromPos(config.wallPos)
    if item.uid == config.switchUID then
        doRemoveItem(getWall.uid, 1)
        doPlayerSendTextMessage(cid, 19, config.removeMessage)
        doTransformItem(item.uid, item.itemid + 1)
        addEvent(createWall, config.timer)
    end
  return TRUE 
end
 
this should work:

LUA:
local config = 
{
        removeMessage = "Think it worked?", -- Message when you remove the wall
        wallPos = {x=1001, y=406, z=8, stackpos=1}, -- Position of the wall
        switchUID = 2300, -- Unique ID of the switch
        timer = 1*60*1000 -- After how long time the wall should be created again after using the switch 
}

function createWall()
    doCreateItem(1304, 1, config.wallPos) -- Replace 1112 to the ID of your wall
  return TRUE  
end

function onUse(cid, item, frompos, item2, topos)
            
local getWall = getThingFromPos(config.wallPos)
    if item.uid == config.switchUID then
        doRemoveItem(getWall.uid, 1)
        doPlayerSendTextMessage(cid, 19, config.removeMessage)
        doTransformItem(item.uid, item.itemid + 1)
        addEvent(createWall, config.timer)
    end
  return TRUE 
end

Thanks a ton
 
Back
Top