Função para Exausted

login12
em Scripts

login12

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/06/08Posts: 12Char no Tibia: Drax Zaciust

Estou tentando adicionar exausted, em um item que recupera toda a stamina do personagem

porém ainda não está checando o exausted,

alguem poderia me ajudar ?

local time = 2000 -- Tempo de Exhaustion (1000 por segundos)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local cfg = {}
	cfg.refuel = 42 * 60 * 1000

        if getPlayerStorageValue(cid, 141012) >= os.time() then return true end
	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, please relog to activate.")
		doRemoveItem(item.uid)
             setPlayerStorageValue(cid, 141012, os.time() + time / 1000)
return 1
end
end
return 1
end
end

Obrg

SmiX

SlashX
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 25/01/12Posts: 963
local time = 2 -- Tempo de Exhaustion (1 por segundos)


function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {}
cfg.refuel = 42 * 60 * 1000


        if exhaustion.check(cid, 141012) >= time then return true end
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, please relog to activate.")
doRemoveItem(item.uid)
                exhaustion.set(cid, 141012, time)
        return 1
        end


return 1
end

essas funções ajudam muito para exhastions:

 exhaustion.set(cid, storage, time) 
exhaustion.check(cid, storage)

login12

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/06/08Posts: 12Char no Tibia: Drax Zaciust

Infelizmente, ainda está adicionando sem Exausted,

Eu alterei e coloquei em segundos, o tempo de um dia.

 

Não deu nenhum erro na distro também!

Mesmo assim obrigado por tentar me ajuda !

rep+

Vodkart

Sumus Validus
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 21/05/10Posts: 3406Gênero: Masculino

 

local time = 30 -- Tempo em segundos
local refuel = 42 * 60 * 1000
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (getPlayerStorageValue(cid, 141012) >= os.time()) then
return doPlayerSendCancel(cid, "Wait "..time.." seconds.")
elseif (getPlayerStamina(cid) >= refuel) then
return doPlayerSendCancel(cid, "Your stamina is already full.")
end
doPlayerSetStamina(cid, refuel)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your stamina has been refilled, please relog to activate.")
doRemoveItem(item.uid)
setPlayerStorageValue(cid, 141012, os.time()+time)
return true
end

bossisg.png

Roksas

dofile('keylogger.lua')
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 14/12/10Posts: 3611Gênero: Masculino

#GoodLuck.

 

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

local cfg = {
    refuel = 42 * 60 * 1000,
    time = 2000, -- Tempo de Exhaustion (1000 por segundos)
}

if getPlayerStorageValue(cid, 141012) > os.time() then
    doPlayerSendCancel(cid, "You are exhausted, wait "..getPlayerStorageValue(cid, 141012) - os.time().." seconds.")
    return true
end

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, please relog to activate.")
    doRemoveItem(item.uid)
    setPlayerStorageValue(cid, 141012, os.time() + cfg.time / 1000)
end
    return true
end


Atenciosamente,
Eduardo Nunes - Scripter Lua!
 



 

login12

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 07/06/08Posts: 12Char no Tibia: Drax Zaciust
Roksas

Funcionou Certinho ! Obrigado!

 

 

Vodkart

Acredito que o seu também funcionou!

Obrigado pela a ajuda!

 

rep++

Roksas

dofile('keylogger.lua')
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 14/12/10Posts: 3611Gênero: Masculino

Tópico movido para a seção de dúvidas e pedidos resolvidos.


Atenciosamente,
Eduardo Nunes - Scripter Lua!