AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   I dont understand this easy code. Pls help me to understand =) (https://forums.alliedmods.net/showthread.php?t=129998)

mottzi 06-19-2010 05:07

I dont understand this easy code. Pls help me to understand =)
 
Hello. Im new at scripting and i dont anderstand this code, witch is using to loop through all players:

PHP Code:

  new players[32], pnumtempid;
  
get_players(playerspnum); // That save every ID to the variavle players right? But what is pnum for??

    
for( new ii<pnumi++ )  // Same. What is pnum for?
    
{
     
        
tempid players[i];


    } 

I dont understand the lines with a comment

ConnorMcLeod 06-19-2010 05:09

Re: I dont understand this easy code. Pls help me to understand =)
 
pnum stands for playersnumber, so it's the number of players that have been collected in players var, so if pnum is 3, players[0] players[1] and players[2] contain ids of the 3 players, and after that variable is empty, that's why you do the loop from i = 0 to i < 3 (pnum)

mottzi 06-19-2010 07:03

Re: I dont understand this easy code. Pls help me to understand =)
 
hey thanks

this forum is awesome


All times are GMT -4. The time now is 14:44.

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