local removee = false -- to remove item set to true
local cooldown = 60 -- colldown to use it again
local storage = 6087 -- empty storage
function onUse(cid, item, frompos, item2, topos)
local temple = getTownTemplePosition(getPlayerTown(cid))
if(getPlayerStorageValue(cid, storage) > os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait another " .. getPlayerStorageValue(cid, storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, storage) - os.time()) == 1 and "" or "s") .. " to teleport.")
else
if not hasCondition(cid,CONDITION_INFIGHT) then
doTeleportThing(cid,temple,false)
doSendMagicEffect(temple,10)
doPlayerSendTextMessage(cid,25,"Teleported to temple safely.")
setPlayerStorageValue(cid, storage, os.time() + cooldown)
if removee == true then
doRemoveItem(item.uid)
end
else
doPlayerSendCancel(cid,"You can't teleport to temple during fight")
end
end
return TRUE
end