Caduceus
Unknown Member
- Joined
- May 10, 2010
- Messages
- 321
- Solutions
- 2
- Reaction score
- 24
The switch works correctly as far as creating the steps, the timer resets the switch, but the steps do not get removed on reset. This is for tfs 1.1
Code:
local stairPos = {
[1] = {x=1120, y=927, z=9, stackpos=1},
[2] = {x=1120, y=928, z=9, stackpos=1}
}
local function reset(p)
-- reset switch
doTransformItem(getTileItemById(p, 1946).uid, 1945)
-- remove stairs
doTransformItem(getThingfromPos(stairPos[1]).uid, 0)
doTransformItem(getThingfromPos(stairPos[2]).uid, 0)
end
function onUse(cid, item, frompos, item2, topos)
-- check if lever is currently used
if item.itemid == 1946 then
return doPlayerSendTextMessage(cid, 22, "Switch is active.")
end
-- transform lever, and add reset
doTransformItem(item.uid, item.itemid + 1)
addEvent(reset, 5 * 60 * 1000, topos)
-- create steps, send message and effect
doCreateItem(8378, 1, stairPos[1])
doCreateItem(8379, 1, stairPos[2])
doPlayerSendTextMessage(cid, 22, "Access Granted!")
return true
end
Last edited: