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

Simple lever script help.

Sam141

New Member
Joined
Feb 17, 2014
Messages
8
Reaction score
0
Hello people!

I need some help with something very simple. Can anyone make me a simple lever script.

totally normal lever. When you use it the lever removes a wall and when you use it again the wall comes back
 
Very simple and easy to understand if you are new:

Set uniqueid = 1000 on the wall

Code:
function onUse(cid, item, topos, frompos)
 
    local wallID, pos, push = 1022, {x=1000, y=1000, z=7}, {x=1000, y=1001, z=7}
 
    if item.itemid == 1945 then
        doRemoveItem(1000, 1)
        doTransformItem(item.uid, 1946)
    elseif item.itemid == 1946 then
        doTransformItem(item.uid, 1945)
        doRelocate(pos, push)
        doCreateItem(wallID, 1, pos)
    end
    return TRUE
end
 
Thanks man!

Hey dude

Code:
function onUse(cid, item, topos, frompos)
    local wallID, pos, push = 1022, {x=1000, y=1000, z=7}, {x=1000, y=1001, z=7}
    if item.itemid == 1945 then
        doRemoveItem(1000, 1)  << What is the 1000? the unique id? and if so then it removes the item but only once
        doTransformItem(item.uid, 1946)
    elseif item.itemid == 1946 then
        doTransformItem(item.uid, 1945)
        doRelocate(pos, push)
        doCreateItem(wallID, 1, pos)
    end
    return TRUE
end
 
Last edited by a moderator:
its a wall that open when u click the lever. and when u close the lever it closes the wall.. then when u click it again same thing happens

its basically a door with the lever

doRemoveItem(1000, 1)
doCreateItem(wallID, 1, pos)
'sorry but also what does the 1 represent?
 
Last edited by a moderator:
ye but how can i make it remove the wall whenever i click as many times as i want

bump
 
Last edited by a moderator:
Okay, if that didn't work thean use this:

Code:
function onUse(cid, item, topos, frompos)

    local cfg = {
        wallPos = {x=1000, y=1000, z=7, stackpos=1},
        wallPush = {x=1000, y=1001, z=7}, -- Relocate creature/item to this Pos if it blocks wallPos
        wallId  = 1022
    }
 
    if item.itemid == 1945 then
        doRemoveItem(getThingfromPos(cfg.wallPos).uid)
        doTransformItem(item.uid, 1946)
    elseif item.itemid == 1946 then
        doRelocate(cfg.wallPos, cfg.wallPush)
        doCreateItem(cfg.wallId, 1, cfg.wallPos)
        doTransformItem(item.uid, 1945)
    end
    return TRUE
end
 
Back
Top