dhrsantan
A.K.A Lbakiller
Credits go to: megachock for the original script.
original topic: http://otland.net/threads/my-first-script-remove-and-auto-create-wall-in-seconds-with-lever.180808/
I just made it possible to disable the timer.
the script:
original topic: http://otland.net/threads/my-first-script-remove-and-auto-create-wall-in-seconds-with-lever.180808/
I just made it possible to disable the timer.
the script:
Code:
local pos = {x = 1018, y = 962, z = 7}
local wall = 1544
local seconds = 0 -- use 0 to disable
local event = 0
local function reset(leverPos)
local lever = getTileItemById(leverPos, 1946).uid
doTransformItem(lever, 1945)
doCreateItem(wall, 1, pos)
doPlayerSendTextMessage(cid,21,"The pass has been closed!")
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
doRemoveItem(getTileItemById(pos,wall).uid)
doPlayerSendTextMessage(cid,21,"You have opened the pass, Beware!")
if seconds > 0 then
event = addEvent(reset, seconds * 1000, getThingPos(item.uid))
end
doTransformItem(item.uid,item.itemid+1)
elseif item.itemid == 1946 then
stopEvent(event)
doPlayerSendTextMessage(cid,21,"You have closed the pass!")
doTransformItem(item.uid,item.itemid-1)
doCreateItem(wall, 1, pos)
end
return true
end