Jump to content

How can I use For ...


Booo

Recommended Posts

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 by Guest
Link to comment
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 by Guest
Link to comment

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
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
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...