Gsp
RP
- Joined
- Jan 3, 2008
- Messages
- 250
- Solutions
- 1
- Reaction score
- 4
guys i'm trying to make a script that will teleport the player who pulls the lever (or just clicks on the item) and 30 seconds later the player will be teleported again but this time to a different location
i tried something but did not work. (im a noob by the way)
i tried something but did not work. (im a noob by the way)
Lua:
local level = 0
local seconds = 30
local event = 0
local event2 = 0
local function reset(leverPos)
local lever = getTileItemById(leverPos, 1946).uid
doTransformItem(lever, 1945)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 and getPlayerLevel(cid) >= level then
doTeleportThing(cid, {x = 349, y = 171, z = 13})
event = addEvent(reset, seconds * 1000, getThingPos(item.uid))
end
doTeleportThing(cid, {x = 385, y = 171, z = 13})
event2 = addEvent(reset, seconds * 1000, getThingPos(item.uid))
doTransformItem(item.uid,item.itemid+1)
elseif item.itemid == 1946 and getPlayerLevel(cid) >= level then
stopEvent(event)
doTransformItem(item.uid,item.itemid-1)
end
return true
end