#Paper Posted August 24, 2011 Share Posted August 24, 2011 The progressbar doesn't increment function createProgressBar(player, time) local x, y = guiGetScreenSize() local toAdd = 100/time progress = guiCreateProgressBar(x/2, y/3, 300, 30, false) setTimer(function () local prog = guiProgressBarGetProgress(progress) if prog <= 99 then guiProgressBarSetProgress(progress, math.floor(tonumber(prog + toAdd))) elseif prog >= 100 then destroyElement(progress) end end, 1000, time/1000) end or insted to make how i made it, how can i make the bar increment smootly proportional the time? P.S: Time value is 8000 Link to comment
SDK Posted August 24, 2011 Share Posted August 24, 2011 Try this, quickly made and not tested function createProgressBar(player, time) local x, y = guiGetScreenSize() progress = guiCreateProgressBar(x/2, y/3, 300, 30, false) setTimer(function (starttick, time) local prog = (getTickCount() - starttick)/time * 100 if prog < 100 then guiProgressBarSetProgress(progress, prog ) else destroyElement(progress) end end, 1000, time/1000, getTickCount(), time) end Link to comment
#Paper Posted August 24, 2011 Author Share Posted August 24, 2011 Thanks, works But how to make that the bar increment smootly proportional the time? Link to comment
SDK Posted August 24, 2011 Share Posted August 24, 2011 Change the 1000 (=1000ms=1s) interval to something smaller, 50 or 100 Link to comment
#Paper Posted August 25, 2011 Author Share Posted August 25, 2011 Change the 1000 (=1000ms=1s) interval to something smaller, 50 or 100 Can you make a little example? Link to comment
SDK Posted August 25, 2011 Share Posted August 25, 2011 I typed exactly what you need to do, did you make this code yourself? 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