darkmu
Well-Known Member
I'm making a system that when dying, the player will have time so that he can trigger an item and recover all lost experience (NOTE: EXPERIENCE AND NOT LEVEL), however I don't know if there is any function on the LUA or if I have to make any formula , will be that someone can help me, my biggest problem and calculate when he has with bless and without bless.
Lua:
function math.percent(percent,maxvalue)
if tonumber(percent) and tonumber(maxvalue) then
return (maxvalue*percent)/100
end
return false
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local porcentagem = getConfigInfo('deathLosePercent')
local expRetorno = math.percent(1.85, math.floor(player:getExperience()))
player:addExperience(expRetorno, true)
-- player:setStorageValue(15715, 0)
return true
end