Lua Small Stamina TFS 1.3 revs

adrian alvarez

New Member
Joined
Mar 7, 2017
Messages
34
Solutions
1
Reaction score
3
inside of scripts/actions
Code:
stamina:id(12662) change the item id you want

Code:
local StaminaValue = 4 * 60   stamina amount you want add

Lua:
local stamina = Action()

function stamina.onUse(player, item, fromPosition, itemEx, toPosition)
    local StaminaLevel = player:getStamina()
    local StaminaMax = 42 * 60
    local StaminaValue = 4 * 60
    if StaminaLevel >= StaminaMax then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Your stamina is already full.")
    elseif(not player:isPremium()) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You must have a premium account.")
    else
        player:setStamina(StaminaLevel + StaminaValue)
        player:getPosition():sendMagicEffect(30)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Your stamina has been refilled.")
        Item(item.uid):remove(1)
    end
    return true
end

stamina:id(12662)
stamina:register()
 

Codinablack

Dreamer
Content Editor
Premium User
Joined
Dec 26, 2013
Messages
1,313
Solutions
4
Reaction score
448
I'm certain many are grateful to have this, but unfortunately not many may find it here, as this is the wrong section to release scripts, this is the support section
 
Top