SA-MP Forums Archive
double loop. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: double loop. (/showthread.php?tid=612984)



double loop. - Spenker - 23.07.2016

Not work. Stops at 0, does not increase greater than 0.

HTML Code:
for(new i = 0, r = 0; i <= GetPlayerPoolSize(), r < 9; i++, r++)



Re: double loop. - BiosMarcel - 23.07.2016

i don't think that is how it works ^^

how about this

sorry if i didnt understand what u tried

PHP Code:
for( new counterOuter 0counterOuter <= GetPlayerPoolSize(); counterOuter++)
{
    
//Your Code
    
for( new counterInner 0counterInner <= GetPlayerPoolSize(); counterInner++)
    {
        
//Your Code
    
}




Re: double loop. - Stinged - 23.07.2016

I don't get what you're trying to do.
Also, it's not recommended to use GetPlayerPoolSize like that in a loop.
The best way to use it is:
Code:
for (new i, j = GetPlayerPoolSize(); i <= j; i++)



Re: double loop. - Gammix - 23.07.2016

It will stop at the two conditions:
pawn Code:
i <= GetPlayerPoolSize()
If it stops on 0, that means you have no players in server.

pawn Code:
r < 9
This one is a constant one so it will stop at 8 all the time.

So your loop can reach a maximum of 8 and minimum of 0.


Re: double loop. - Spenker - 23.07.2016

Quote:
Originally Posted by [Bios]Marcel
View Post
i don't think that is how it works ^^

how about this

sorry if i didnt understand what u tried

PHP Code:
for( new counterOuter 0counterOuter <= GetPlayerPoolSize(); counterOuter++)
{
    
//Your Code
    
for( new counterInner 0counterInner <= GetPlayerPoolSize(); counterInner++)
    {
        
//Your Code
    
}

Ok, thank you.