local config = {
storage = 12345, -- Storage vazia
time = 120, -- Tempo em minutos de stamina a ser recuperada
delay = 60, -- Tempo em minutos para usar novamente
effect = 592, -- Efeito
remove = true -- Remover ao usar
maxstamina = 42 * 60 -- Stamina maxima
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (getPlayerStorageValue(cid, config.storage) >= os.time()) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need to wait " .. ((getPlayerStorageValue(cid, config.storage) - os.time()) / 60)..", minutes to refill your stamina again.")
end
if (getPlayerStamina(cid) >= config.maxstamina) then
return doPlayerSendCancel(cid, "Your stamina is already full.")
end
doPlayerAddStamina(cid, config.time)
doSendMagicEffect(getThingPos(cid), config.effect)
setPlayerStorageValue(cid, config.storage, os.time() + config.delay * 60)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your stamina has been refilled in " .. config.time .. " minutes, please relog to activate.")
if (config.remove) then
doRemoveItem(item.uid, 1)
end
return true
end