Kryzax
The cake is a lie
- Joined
- May 31, 2012
- Messages
- 18
- Reaction score
- 1
I made a script but it has a problem (always a problem..). After 5 seconds the timer puts the switch back to its original position but if theres a monster or person standing on the lever then it doesn't work. I think it's because of stackpos but I have no idea how to fix it! Here's the code:
Advice please!? Thanks
Lua:
function onUse(cid, item, fromPos, item2, toPos)
if getThingFromPos(firstwallpos1).itemid == 8861 and getThingFromPos(firstwallpos2).itemid == 8861 and getThingFromPos(firstwallpos3).itemid == 8861 and item.itemid == 1945 and item.uid == 1001 then --Lever1
doRemoveItem(getThingfromPos(firstwallpos1).uid, 1) -- RemoveWall
doRemoveItem(getThingfromPos(firstwallpos2).uid, 1) -- RemoveWall
doRemoveItem(getThingfromPos(firstwallpos3).uid, 1) -- RemoveWall
doTransformItem(item.uid,1946)
addEvent(onTimer, 10000)
end
return true
end
function onTimer()
doTransformItem(getThingFromPos({x=886, y=986, z=7, stackpos=1} ).uid, 1945)--lever pos
doCreateItem(8861,1,{x=901, y=990, z=7})-- Stone pos
doCreateItem(8861,1,{x=902, y=990, z=7})-- Stone pos
doCreateItem(8861,1,{x=903, y=990, z=7})-- Stone pos
end
Advice please!? Thanks