Raised This Month: $ Target: $400
 0% 

Solved loop entitys


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
MrPickles
Senior Member
Join Date: Aug 2022
Location: Colombia
Old 11-16-2022 , 14:59   Re: loop entitys
Reply With Quote #9

Quote:
Originally Posted by MrPickles View Post
nop, u are wrong, the loop doesnt count from 0 to 100, look:

if this is my array:
PHP Code:
{2,4,6,100
the loop do this:

PHP Code:
     // i        i++
Array[0] = // i = 0
Array[1] = // i = 1
Array[2] = // i = 2
Array[3] = 100 // i = 3, oops this cell contain 100, so we can stop 
thats why the condition,
PHP Code:
__int_Entitys[i] < 100 
if it was counting from 0 to 100, it will be
PHP Code:
100 
, but isnt the case, u can check it by yourself with the prints that i setted

check it with this:

PHP Code:
public TestClient )
{
        
removeTransEntsClient, {2,8,15,100} ); 
        return 
1;
}
removeTransEnts(Client__int_Entitys[] )  
{
        for( new 
0__int_Entitys[i] < 100i++)
        { 
               
client_printClientprint_chat"The Cell [%d] have a value of  = %d"i__int_Entitys[i] );          
        }
        
client_printClientprint_chat"End of the Loop" );

Quote:
Originally Posted by Natsheh View Post
Why don't you make the loop as following it will be rather than using 100 to stop the loop.

PHP Code:
for( new 0__int_Entitys[i] < 100i++)[ 

PHP Code:
for( new 0maxloop strlen(__int_Entitys) - 1maxloopi++) 
it is more simple to set 100, thats all, more operations are saved
in a loop the simpler is better, think that each time you will be checking and obtaining the length of the array (-1), instead with 100, it only checks if it is the cell contain 100

Last edited by MrPickles; 11-16-2022 at 15:08.
MrPickles is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode