Ir para conteúdo
Entre para seguir isso  
Majesty

[TFS 1.x] Player.setExhaustion, Player.getExhaustion

Recommended Posts

Majesty    1755
Majesty

[TFS 1.x] Player.setExhaustion, Player.getExhaustion

Citar

Nome: [TFS 1.x] Player.setExhaustion, Player.getExhaustion

Versão: [10.x+] // Qualquer uma disponível para TFS 1.x

Tipo do script: Função

Créditos: Printer

function Player.setExhaustion(self, value, time)
    return self:setStorageValue(value, time + os.time())
end

function Player.getExhaustion(self, value)
    local storage = self:getStorageValue(value)
    if storage <= 0 then
        return 0
    end

    return storage - os.time()
end

Exemplo de uso:

function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if player:getExhaustion(1350) <= 0 then
        player:setExhaustion(1350, 10)
    else
        print('You\'re exhausted for: '..player:getExhaustion(1350)..' seconds.')
    end
    return true
end

 

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×