18.11.2017, 04:16
Код:
stock OwnedTurfs2( teamid ) { new turf; for (new i = 0; i < MAX_TURFS; i++) if (turfs[ i ][TurfOwner] == teamid) TeamInfo[ teamid ][ TeamTurfs ] = 0,TeamInfo[ teamid ][ TeamTurfs ]++; return turf; }
stock OwnedTurfs2( teamid ) { new turf; for (new i = 0; i < MAX_TURFS; i++) if (turfs[ i ][TurfOwner] == teamid) TeamInfo[ teamid ][ TeamTurfs ] = 0,TeamInfo[ teamid ][ TeamTurfs ]++; return turf; }
Isn't that loop looping and updating the turf's value and then returning it for further use?
|
stock OwnedTurfs2(teamid) //calling the function with a team id
{
new turf; //new variable 'turf' which has a value of 0
for (new i = 0; i < MAX_TURFS; i++) //looping from 0 to max turfs number
{
if(turfs[i][TurfOwner] == teamid) //if the loop found that turf owner = teamid (i really don't know how would an owner name will equal a number)
{
TeamInfo[teamid][ TeamTurfs ] = 0 // reseting team turfs to 0
TeamInfo[teamid][ TeamTurfs ]++; // add +1 to team turfs after resetting it to 0 (which make no sense)
}
}
return turf; //return 0 which is variable 'turf' as u havent change the value of it
}
PHP код:
|
stock OwnedTurfs2(teamid) //calling the function with a team id
{
new turf; //new variable 'turf' which has a value of 0
for (new i = 0; i < MAX_TURFS; i++) //looping from 0 to max turfs number
{
if(turfs[i][TurfOwner] == teamid) //if the loop found that turf owner = teamid (i really don't know how would an owner name will equal a number)
{
TeamInfo[teamid][ TeamTurfs ]++; // add +1 to team turfs after resetting it to 0 (which make no sense)
}
}
return turf; //return 0 which is variable 'turf' as u havent change the value of it
}
for (new teams=0; teams<MAX_TEAMS; teams++) OwnedTurfs2( teams );
for (new teams=0; teams<MAX_TEAMS; teams++) OwnedTurfs2( teams );