#6

Quote:
Originally Posted by Uniqueee
Quote:
Originally Posted by KDlivest954
wat is and how do i make a loop?
I don't know how your system works but I will show you how to make a loop.
Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerTeam[playerid] == Police)
{
SendClientMessage(playerid,0xFFFFFFAA,"BLA BLA BLA");
}
}
This code means that it will go through every player, MAX_PLAYERS being 500 the loop will run 500 times and as the loop increases so does the i integer.

The correct code would be.

pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(PlayerTeam[i] == Police) // User is a cop.
        {
            SendClientMessage(playerid,0xFFFFFFAA,"BLA BLA BLA");
        }
    }
}
Don't mind the indentation it was done in notepad.
Reply


Messages In This Thread
/911 - by Steven82 - 31.03.2010, 01:42
Re: /911 - by Nakash - 31.03.2010, 02:50
Re: /911 - by KDlivest954 - 31.03.2010, 02:55
Re: /911 - by Nakash - 31.03.2010, 03:00
Re: /911 - by KDlivest954 - 31.03.2010, 03:14
Re: /911 - by Norn - 31.03.2010, 04:21
Re: /911 - by KDlivest954 - 31.03.2010, 05:07
Re: /911 - by mamorunl - 31.03.2010, 06:47
Re: /911 - by Torran - 31.03.2010, 12:55
Re: /911 - by Steven82 - 31.03.2010, 14:59

Forum Jump:


Users browsing this thread: 1 Guest(s)