function onUse(cid, item, frompos, item2, topos)
config = {
rmvitem = true, -- remover item ao usar?
battle = true, -- precisa estar sem battle para teleportar?
townp = true, -- teleportar para a cidade do jogador?
pos = {x=151, y=54, z=7}, -- edite para usar só se townp é false
pz = false, -- precisa estar em PZ?
time_exausted = 10, -- em minutos
storage = 95648 -- n mexa
}
if (config.battle == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
return doPlayerSendCancel(cid, "Você precisa estar sem o batlle.")
elseif (config.pz == true) and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
return doPlayerSendCancel(cid, "Você precisa estar em Protection Zone.")
elseif (getPlayerStorageValue(cid, config.storage) >= os.time()) then
return doPlayerSendCancel(cid, "Espere alguns minutos para teleportar novamente.")
elseif(config.rmvitem == true) then
doRemoveItem(item.uid, 1)
end
if(config.townp == true) then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
else
doTeleportThing(cid,config.pos)
end
doCreatureSay(cid, "~ "..getPlayerName(cid).." Foi Teleportado. ~", TALKTYPE_ORANGE_1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
setPlayerStorageValue(cid,config.storage,os.time()+config.time_exausted*60)
return TRUE
end