tobias89
Pikaz Liek Pikaz
- Joined
- Apr 24, 2010
- Messages
- 110
- Reaction score
- 0
Everything works fine, only the TP out wont spawn 
Did I do somthing wrong ?
Did I do somthing wrong ?
Code:
local pinkstonepos1 = {x=1017, y=596, z=5} -- Blocking stone position.
local TeleportToPos = { x = 908, y = 831, z = 5} -- Position the player will be ported to when leaving the DHQ, like the Temple...
local TeleportInPos = { x = 1024, y = 596, z = 5} -- Position In DHQ.
local LeverPos = { x = 1033, y = 595, z = 5} -- Lever Position
local TeleportoutPos = { x = 1016, y = 595, z = 5} -- Telporter out pos
local timeToRemove = 20 -- Time before quest reset
function onUse(cid, item, frompos, item2, topos)
local pinkstone1 = getTileItemById(pinkstonepos1, 1355) -- You can change the ID to any other kind of blocking item
local teleport = getTileItemById(TeleportInPos, 1387)
if item.itemid == 1945 then
doRemoveItem(pinkstone1.uid, 1)
doCreateTeleport(1387, TeleportToPos, TeleportOutPos)
doSendMagicEffect(TeleportInPos, CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid,22,"The stone is removed, get the reward before the time runs out!") -- Message when the lever is pulled
addEvent(doRemoveTeleport, timeToRemove * 1000)
else if item.itemid == 1946 then
doPlayerSendCancel(cid,"Sorry, not possible.") -- message if the lever is pulled again.
return 1
end
end
end
function doRemoveTeleport()
local teleport = getTileItemById(TeleportInPos, 1387)
local Lever = getTileItemById(LeverPos, 1946)
if teleport.uid > 0 then
doCreateItem(1355, 1, pinkstonepos1)
doRemoveItem(teleport.uid)
doSendMagicEffect(TeleportInPos, CONST_ME_POFF)
doTransformItem(Lever.uid, 1945)
end
end