• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

% Hp and % Mana

There is 2 functions what i use (paste in data/lib/function):
Lua:
function doPlayerAddManaPercent(cid, percent)
local mana = getPlayerMaxMana(cid)
doPlayerAddMana(cid, (mana / 100) * percent)
return TRUE
end
function doPlayerAddHealthPercent(cid, percent)
local health = getCreatureMaxHealth(cid)
doCreatureAddHealth(cid, (health / 100) * percent)
return TRUE
end

and usage:
Lua:
doPlayerAddManaPercent(cid, 10) ---- gives player 10% of his mp
doPlayerAddHealthPercent(cid, 10) ---- gives player 10% of his hp
 
Back
Top