local pinkstonepos1 = {x= XXXX, y= YYYY, z= Z} -- Blocking stone position.
local TeleportToPos = {x = XXXX, y = YYYY, z = Z} -- Position the player will be ported to when leaving the DHQ, like the Temple...
local TeleportInPos = {x = XXXX, y = YYYY, z = Z} -- Position In DHQ.
local LeverPos = {x = XXXX, y = YYYY, z = Z} -- Lever Position
local TeleportOutPos = {x = XXXX, y = YYYY, z = Z} -- Telporter out pos
local timeToRemove = 40 -- Time before quest reset
local function doRemoveTeleport()
local teleport = getTileItemById(TeleportInPos, 1387).uid
if teleport > 0 then
doCreateItem(1355, 1, pinkstonepos1)
doRemoveItem(teleport)
doSendMagicEffect(TeleportInPos, CONST_ME_POFF)
doTransformItem(getTileItemById(LeverPos, 1946).uid, 1945)
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
local pinkstone, teleport = getTileItemById(pinkstonepos1, 1355).uid, getTileItemById(TeleportInPos, 1387).uid
doRemoveItem(pinkstone)
doCreateTeleport(1387, TeleportToPos, TeleportOutPos)
doSendMagicEffect(TeleportInPos, CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid,22,"The stone is removed, get the reward before the time runs out!")
addEvent(doRemoveTeleport, timeToRemove * 1000)
elseif item.itemid == 1946 then
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return TRUE
end
it can't be the same, you're doing something wrong ;ssorry but its still same bug!
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {
stone = { x = 100, y = 100, z = 7 }, -- Stone is Located
teleport = { x = 100, y = 100, z = 7 }, -- Teleport Creates
to = { x = 100, y = 100, z = 7 }, -- Teleport Goes
time = 60 * 1000
}
local function reset()
local tp = getTileItemById(cfg.teleport, 1387)
if(tp.uid > 0) then
doRemoveItem(tp.uid)
doCreateItem(1355, 1, cfg.stone)
doTransformItem(item.uid, item.itemid - 1)
end
return true
end
if(item.itemid == 1945) then
local stoneCheck = getTileItemById(cfg.stone, 1355)
if(stoneCheck.uid > 0) then
doRemoveItem(stoneCheck.uid)
doCreateTeleport(1387, cfg.teleport, cfg.to)
doCreatureSay(cid, "You have opened the passage.", TALKTYPE_ORANGE_1)
addEvent(reset, cfg.time)
end
elseif(item.itemid == 1946)
doPlayerSendCancel(cid, "The passage is already open.")
end
return true
end
???local stoneCheck = getTileItemById(cfg.stone, 1355).uid
if(stoneCheck.uid > 0) then
fixed:
you have to configure the positions again, thoughCode:local pinkstonepos1 = {x= XXXX, y= YYYY, z= Z} -- Blocking stone position. local TeleportToPos = {x = XXXX, y = YYYY, z = Z} -- Position the player will be ported to when leaving the DHQ, like the Temple... local TeleportInPos = {x = XXXX, y = YYYY, z = Z} -- Position In DHQ. local LeverPos = {x = XXXX, y = YYYY, z = Z} -- Lever Position local TeleportOutPos = {x = XXXX, y = YYYY, z = Z} -- Telporter out pos local timeToRemove = 40 -- Time before quest reset local function doRemoveTeleport() local teleport = getTileItemById(TeleportInPos, 1387).uid if teleport > 0 then doCreateItem(1355, 1, pinkstonepos1) doRemoveItem(teleport) doSendMagicEffect(TeleportInPos, CONST_ME_POFF) doTransformItem(getTileItemById(LeverPos, 1946).uid, 1945) end end function onUse(cid, item, fromPosition, itemEx, toPosition) if item.itemid == 1945 then local pinkstone, teleport = getTileItemById(pinkstonepos1, 1355).uid, getTileItemById(TeleportInPos, 1387).uid doRemoveItem(pinkstone) doCreateTeleport(1387, TeleportToPos, TeleportOutPos) doSendMagicEffect(TeleportInPos, CONST_ME_TELEPORT) doPlayerSendTextMessage(cid,22,"The stone is removed, get the reward before the time runs out!") addEvent(doRemoveTeleport, timeToRemove * 1000) elseif item.itemid == 1946 then doPlayerSendCancel(cid,"Sorry, not possible.") end return TRUE end
local config = {
daily = "no" -- once a day?
}
local t = {
{x = 33314, y = 31592, z = 15}, -- stone position
{x = 33316, y = 31591, z = 15}, -- teleport creation position
{x = 33322, y = 31592, z = 14} -- where the teleport takes you
}
config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1945) then
if(getPlayerLevel(cid) > 99) then
local stone = getTileItemById(t[1], 1355).uid
if(stone > 0) then
doRemoveItem(stone)
end
doCreateTeleport(1387, t[3], t[2])
doSendMagicEffect(t[2], CONST_ME_TELEPORT)
else
return doPlayerSendCancel(cid, "You cannot use this object.")
end
elseif(item.itemid == 1946) then
if(config.daily) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
else
doRemoveItem(getTileItemById(t[2], 1387).uid)
doSendMagicEffect(t[2], CONST_ME_POFF)
doCreateItem(1355, 1, t[1])
end
end
return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end