local config = {
remove = true,
-- If you want to disable cooldown, simply set a number less than 1
cooldown = {
time = 60, -- seconds
storage = 000
},
effect = CONST_ME_STUN
}
function onUse(cid, item, fromPos, itemEx, toPos)
if config.cooldown.time >= 1 then
if getCreatureStorage(cid, config.cooldown.storage) > os.time() then
return doPlayerSendCancel(cid, "You can only use this item every " .. config.cooldown.time .. " seconds, please wait.")
end
doCreatureSetStorage(cid, config.cooldown.storage, os.time() + config.cooldown.time)
end
if config.remove then
doRemoveItem(item.uid)
end
if config.effect then
doSendMagicEffect(getThingPosition(cid), config.effect)
end
-- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You feel reborning.")
doCreatureSay(cid, "You feel reborning.", TALKTYPE_ORANGE_2)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
return true
end