Booo Posted April 3, 2012 Share Posted April 3, 2012 (edited) hola all how can I use For with guiProgressBarGetProgress bar = guiCreateProgressBar ( 50, 50, 100, 70, false ) getprogress = guiProgressBarGetProgress(bar) setTimer (function() guiProgressBarSetProgress ( bar,20 ) end, 1000, 1) for k,v in pairs(getprogress) do if v == 20 then outputChatBox("ProgressBar = 20") elseif v == 40 then outputChatBox("ProgressBar = 40") end end Edited April 3, 2012 by Guest Link to comment
BriGhtx3 Posted April 3, 2012 Share Posted April 3, 2012 This can't work because every 10 seconds the progress bar is set to 20% (doesn't make sense) setTimer (function() guiProgressBarSetProgress ( bar,20 ) end, 1000, 0) And why do you want to use for ? Link to comment
Booo Posted April 3, 2012 Author Share Posted April 3, 2012 (edited) This can't work because every 10 seconds the progress bar is set to 20% (doesn't make sense) setTimer (function() guiProgressBarSetProgress ( bar,20 ) end, 1000, 0) And why do you want to use for ? 1000 = 1 seconds not 10 seconds !! And not given for an example of the attention it np example I want to use For with guiProgressBargetProgress .. can you help me Edited April 3, 2012 by Guest Link to comment
arezu Posted April 3, 2012 Share Posted April 3, 2012 If you are trying to use for loop for animation, then you are on the wrong track. setTimer (function() guiProgressBarSetProgress(bar, guiProgressBarGetProgress(bar)+10) end, 1000, 0) maybe thats somewhat like what you are trying to do? Link to comment
drk Posted April 3, 2012 Share Posted April 3, 2012 CTimer = { } bar = guiCreateProgressBar ( 50, 50, 100, 70, false ) CTimer [ localPlayer ] = setTimer ( function ( ) guiProgressBarSetProgress ( bar, guiProgressBarGetProgress ( bar ) + 20 ) if ( guiProgressBarGetProgress ( bar ) == 100 ) then killTimer ( CTimer [ localPlayer ] ) end end, 1000, 0 ) Link to comment
Booo Posted April 3, 2012 Author Share Posted April 3, 2012 lol , guys i need use For with guiProgressBarGetProgress not setTimer how can use For ?? It not work Link to comment
drk Posted April 3, 2012 Share Posted April 3, 2012 You don't need use for-loop. Anyway, explain what you want to do. Link to comment
Booo Posted April 3, 2012 Author Share Posted April 3, 2012 You don't need use for-loop.Anyway, explain what you want to do. Draken i need use For with guiProgressBarGetProgress and get Value guiProgressBarGetProgress if GetProgress == 20 outputChatBox("ProgressBar = 20 ") look at the example bar = guiCreateProgressBar ( 50, 50, 100, 70, false ) getprogress = guiProgressBarGetProgress(bar) setTimer (function() guiProgressBarSetProgress ( bar,20 ) end, 1000, 1) for k,v in pairs(getprogress) do if v == 20 then outputChatBox("ProgressBar = 20") elseif v == 40 then outputChatBox("ProgressBar = 40") end end Link to comment
drk Posted April 3, 2012 Share Posted April 3, 2012 And why the hell you need for-loop? bar = guiCreateProgressBar ( 50, 50, 100, 70, false ) setTimer ( function ( ) guiProgressBarSetProgress ( bar, 20 ) outputChatBox ( 'Progress Bar = ' .. guiProgressBarGetProgress ( bar ) ) end, 1000, 1 ) Link to comment
Castillo Posted April 3, 2012 Share Posted April 3, 2012 @Booo: Do you know what a for-loop is? for-loops are used with tables, you can't use it with a number/string. http://www.lua.org/pil/4.3.4.html 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