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

Reset lever

Massacre Madnes

New Member
Joined
Oct 31, 2011
Messages
2
Reaction score
0
Hi I wanted to make it so when a person pulls a lever after a minute it resets on its own.

here is the script I am using..


LUA:
function onUse(cid, item, frompos, item2, topos)

local wallpos1    = {x=2567, y=3141, z=9, stackpos=1}   --- coordinates of the wall to be removed ---
local wall1    = getThingfromPos(wallpos1)
local toPos = {x=2559, y=3140, z=10} 
local wallID    = 1387 --- item id of the wall to be removed ---


    if item.itemid == 1946 then
        doRemoveItem(wall1.uid, 1)
    elseif item.itemid == 1945 then
        doCreateTeleport(wallID, toPos, wallpos1)
		addEvent(doTransformItem, 1*60*1000, item.uid, 1946)
    end

end


As you see, the script makes a teleporter when you flip the switch from 1946 to 1945 that works perfectly.

when you use it again, it goes back to 1946 and removes the teleporter.

What I also want it to do is automatically after a minute, to have the switch go back to 1946 and remove the teleport on its own.

Can someone tell me what I am doing wrong?
 
Back
Top