for(new a;a<55,IsPlayerConnected(a);a++) problem need help please
#8

Quote:
Originally Posted by Kyosaur!!
Change

Код:
for(new a;a<55,IsPlayerConnected(a);a++)
To

Код:
for(new a=0, i=GetMaxPlayers(); a<i; a++)
{
	if(!IsPlayerConnected(a)) continue;

	//rest of your code
}
The GetMaxPlayers part will Get the maximum possible players for your server (what ever is specified in youe server.cfg) and is the most efficient way of dueing player loops IMO (some say defining a new MAX_PLAYERS is better, but thats not dynamic / needs to be manually changed if you ever set your player count lower / higher).


If you dont want to skip unconnected id's comment out the "if(!IsPlayerConnected(a)) continue;" part.
Thanks 100x it worked
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)