• 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 Timer Wall Remove

Badoo604

New Member
Joined
Nov 14, 2010
Messages
10
Reaction score
0
Need help with a script
when u click the lever it removes a wall at xx position for 5 minutes then the wall
goes back please and ty
 
Lua:
local stonepos = {x=535, y=1266, z=10, stackpos=1} -- Stone pos
function onUse(cid, item, fromPos, item2, toPos)
    if item.itemid == 1945 then
        doRemoveItem(getThingfromPos(stonepos).uid, 1)
        doTransformItem(item.uid,1946)
        addEvent(onTimer5, 2*60*1000) --2minutes
    end
return true
end

function onTimer5() --creates wall back
    doTransformItem(getThingFromPos({x=535, y=1251, z=10, stackpos=1}).uid, 1945)--lever pos
    doCreateItem(1304,1,{x=535, y=1266, z=10})-- Stone pos
end
 
Lua:
local pos, e = {x=535, y=1266, z=10}, 0
local f = function(p)
	doCreateItem(1304, 1, pos)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, 1304).uid)
		e = addEvent(f, 5 * 60 * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
	else
		stopEvent(e)
		e = 0
		f(fromPosition)
	end
	return true
end
 
Funny, I was browsing through 4 pages looknig for something I could use for my ot. Then I went back to my map and realized i had an unfinished quest, where I need several timed levers, and at that point I saw this thread, that's just so lucky, thanks guys:)
 
Feedback: somehow the first script (which is also a example script in TFS) doesen't work for me anymore. i know it did once, but now it doesen't. Cykotitans script is working good at the moment.
 
Lua:
local pos, e = {x=535, y=1266, z=10}, 0
local f = function(p)
	doCreateItem(1304, 1, pos)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, 1304).uid)
		e = addEvent(f, 5 * 60 * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
	else
		stopEvent(e)
		e = 0
		f(fromPosition)
	end
	return true
end

Been looking for this, works like a sharm! rep+ :)
 
Hmm, I need help with this one.. I pull the lever the stone remove, and then after 2 minutes it appears back but it seems like where the lever is it creates another lever or something and i cant click it again and when i remove the lever theres more then 1 lever now I know this because when i click it theres another one behind it pulled the opposite way

bump
 
Last edited by a moderator:
Its not working for me.. the switch moves back and forth and doesnt remove wall.

Code:
local pos, e = {x=1689, y=1091, z=9}, 0
local f = function(p)
doCreateItem(1049, 1, pos)
doTransformItem(getTileItemById(p, 1946).uid, 1945)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
doRemoveItem(getTileItemById(pos, 1049).uid)
e = addEvent(f, 5 * 60 * 1000, fromPosition)
doTransformItem(item.uid, 1946)
else
stopEvent(e)
e = 0
f(fromPosition)
end
return true
end
 
Lua:
local pos, e = {x=535, y=1266, z=10}, 0
local f = function(p)
    doCreateItem(1304, 1, pos)
    doTransformItem(getTileItemById(p, 1946).uid, 1945)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 then
        doRemoveItem(getTileItemById(pos, 1304).uid)
        e = addEvent(f, 5 * 60 * 1000, fromPosition)
        doTransformItem(item.uid, 1946)
    else
        stopEvent(e)
        e = 0
        f(fromPosition)
    end
    return true
end

it does not work on r3884.. pls help
got error on near `pos'
 
Back
Top Bottom