Hello i need help with this script, because I can not add this... When we logout or die, regeneration is active, can you add this? i tried with login.lua but i am newbie and this have no results..
Code:
local config = {
amount = 50, -- HPs by second
time = 3600, -- seconds
exhaust = {
storage = 12412,
time = 3601, -- Exhaust time seconds~
}
}
local function doRegeneration(cid, amount, seconds)
if seconds <= 0 then
return false
end
doCreatureAddHealth(cid, amount)
doCreatureAddMana(cid, amount)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
return addEvent(doRegeneration, 1000, cid, amount, seconds - 1)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if exhaustion.check(cid, config.exhaust.storage) then
return doPlayerSendCancel(cid, "You're exhausted.")
end
doRemoveItem(item.uid, 1)
doRegeneration(cid, config.amount, config.time)
exhaustion.set(cid, config.exhaust.storage, config.exhaust.time)
return true
end