local cfg = {
ClickHere = XXXX, -- Item you click.
GATE_ID = XXXX, -- The gate item id.
ClickUID = 3300, -- Item you click, unique ID.
gateTime = 3 -- Minutes to leave gate open.
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local gatePosition = {x=100, y=100, z=7, stackpos=1} -- Position of the gate.
local getGate = getThingFromPos(gatePosition)
if (item.itemid == cfg.ClickHere) and (getGate.itemid == cfg.GATE_ID) then
doRemoveItem(getGate.uid)
doSendMagicEffect(gatePosition, CONST_ME_POFF)
doCreatureSay(getCreaturePosition(cid), "You have ".. cfg.gateTime .." minutes to enter the teleport.", TALKTYPE_ORANGE_1)
addEvent(doCreateItem, cfg.gateTime * 60 * 1000, cfg.GATE_ID, 1, gatePosition)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The gate appears to already be missing.")
end
return true
end