[XGN]Razor Posted February 6, 2016 Share Posted February 6, 2016 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 Link to comment
Tomas Posted February 6, 2016 Share Posted February 6, 2016 What's frozenMT & cachexp? Link to comment
[XGN]Razor Posted February 6, 2016 Author Share Posted February 6, 2016 forzenMT is for changing the data addEventHandler ( "onClientElementDataChange", getLocalPlayer(), function ( dataName ) if dataName == "exp" then frozenMT = 0 end end ) and cacheEXP is the exp that the player wins on an elementData, even if i delete the +frozenMT+cacheEXP the bar dont moves, only grows to both directions Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now