Changing normal loop with foreach
#1

Hi, i've just switched to foreach since it has a more efficient loop, but i can't convert this loop to a foreach loop

pawn Код:
for(new i = 0; i < sizeof (IsPlayerCapturing[]); ++i)
    {
        if(IsPlayerCapturing[playerid][i] == true)
        {
            LeavingZONE(playerid, i);
            SendClientMessage(killerid, COLOR_PINK, "[NOTICE]: You have prevented the ennemy from capturing this zone, +1XP!");
            SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
            IsPlayerCapturing[playerid][i] = false;
        }
    }
Reply
#2

Use foreach for players loop, you don't need it for the above and neither you've to create an iterator for that. The way you do it is just fine.
Reply
#3

Thanks !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)