Forkz
Well-Known Member
- Joined
- Jun 29, 2020
- Messages
- 380
- Solutions
- 1
- Reaction score
- 89
Hi otlanders,
I would like to add a time to use this item, could anyone help me?
I would like to add a time to use this item, could anyone help me?
Lua:
function onUse(cid, item, frompos, item2, topos)
local config = {
protect = false, -- precisa estar em protection zone
battle = false, -- precida estar sem battle
removeItem = false -- remover item ao usar
}
local pos = getTownTemplePosition(getPlayerTown(cid)) -- posição para ser teleportado
local playerPos = getCreaturePosition(cid)
local levelplayer = 1
if ((levelplayer and getPlayerLevel(cid) < levelplayer)) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "you need to be level 100 or higher.")
return false
end
if config.protect and not getTilePzInfo(playerPos) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You need to be in the protection zone to teleport.")
return false
elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You need your battle to leave to teleport.")
return false
end
if config.removeItem then
doRemoveItem(item.uid)
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Now you can request your supreme vocation to the lord of vocation.")
doSendMagicEffect(playerPos, CONST_ME_POFF)
doTeleportThing(cid, pos)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
return true
end