18.11.2017, 09:23
Quote:
Isn't that loop looping and updating the turf's value and then returning it for further use?
|
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 ] = 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
}