• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Stamina Item

kleitonalan

New Member
Joined
Mar 21, 2013
Messages
289
Reaction score
3
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {}
cfg.refuel = 42 * 60 * 1000
if(getPlayerStamina(cid) >= cfg.refuel) then
doPlayerSendCancel(cid, "Your stamina is already full.")
else
doPlayerSetStamina(cid, cfg.refuel)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your stamina has been refilled.")
doRemoveItem(item.uid)
end
return true
end





I wish someone modify this item, after the player of this use, he could wear again so after 12:0 am.
 
Last edited:
the use of player stamina back 42, wanted to he could use only 24 hours after the item again.

help
 
Last edited by a moderator:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local config = {
    refuel = 42 * 60 * 1000,
    storageExhaust = 55668,
    exhaustTime = 86400
    }
 
        if exhaustion.check(cid, config.storageExhaust) ~= false then
            doPlayerSendCancel(cid, "You can only refill once every 24 hours!")
            return true      
        elseif(getPlayerStamina(cid) >= config.refuel) then
            doPlayerSendCancel(cid, "Your stamina is already full.")
        else
            doPlayerSetStamina(cid, config.refuel)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your stamina has been refilled.")
            exhaustion.set(cid, config.storageExhaust, config.exhaustTime)
        end
    return true
end

This might work, post error otherwise! :)
 
Last edited by a moderator:
[Error - LuaInterface::loadFile] data/actions/scripts/Stamina.lua:3: '}' expecte
d (to close '{' at line 2) near '='
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/Stamina.l
ua)
data/actions/scripts/Stamina.lua:3: '}' expected (to close '{' at line 2) near '
='
 
15:20 Your stamina has been refilled.
15:20 Your stamina has been refilled.
15:20 Your stamina has been refilled.
15:21 Your stamina has been refilled.
15:21 Your stamina has been refilled.
15:21 Your stamina has been refilled.
 
thanks for you help me.
One more thing if it is not asking too much, would do when he used the There is talk in default item,
EXEMPLO :You can use this item at 23:20:10.
showing time to be able to use it again?
 
Last edited:
Back
Top