PDA

View Full Version : I dont understand this easy code. Pls help me to understand =)


mottzi
06-19-2010, 05:07
Hello. Im new at scripting and i dont anderstand this code, witch is using to loop through all players:

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

for( new i; i<pnum; i++ ) // Same. What is pnum for?
{

tempid = players[i];


}I dont understand the lines with a comment

ConnorMcLeod
06-19-2010, 05:09
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
hey thanks

this forum is awesome