Hello, im doing a percent bar with an images, and i have an error doing the calculations, the bar looks fine at the first percents, but when reachs 100% and reset, goes to the 50% and never goes to the 0%
and when the exp grow up, the bar moves to the right.
sw,sh = guiGetScreenSize ()
function getPercent(level,expe)
local level = math.min(tonumber(level or 0),(#Levels-1))
local needEXP = Levels[level+1]
return ((tonumber(expe) or 0)/needEXP)
end
function getCentPer(level,expe)
return math.ceil(getPercent(level,expe)*100)
end
function renderUHG()
local lvl = (tonumber(getElementData(getLocalPlayer(),"level")) or 0)
local pexp = (tonumber(getElementData(getLocalPlayer(),"exp")) or 0)+frozenMT+cachexp
local myper = getCentPer(lvl,pexp)
dxDrawImage(sw*0.0001,sh*.93,500,100,"emptybar.png")
dxDrawImageSection(sw*0.035,sh*.94359,myper,70,100,50,100,100,"fullbar.png")
im dont know how to put fine the u,v,usize,vsize variables