25.08.2010, 19:14
Y_less, good critique.
I wan't to ask you, is this foreach i'm using is good?
I wan't to ask you, is this foreach i'm using is good?
pawn Код:
#define ForEachPlayer(%0) for(new index_%0=0, %0=ConnectedPlayerList[0]; index_%0<ConnectedPlayers; index_%0++, %0=ConnectedPlayerList[index_%0])
pawn Код:
public OnPlayerConnect(playerid)
{
ConnectedPlayerList[ConnectedPlayers++]=playerid;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
for(new i=0;i<ConnectedPlayers;i++)
{
if(ConnectedPlayerList[i]==playerid)
{
ConnectedPlayers--;
ConnectedPlayerList[i]=ConnectedPlayerList[ConnectedPlayers];
}
}
}