Action Small Stamina TFS 1.3 revs

adrian alvarez

New Member
Joined
Mar 7, 2017
Messages
34
Solutions
1
Reaction score
3
inside of data/scripts/actions create lua archive and put this

Lua:
stamina:id(12662) change the item id you want

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

Code:
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()
 
Top