Assign everyone a random ID
#1

Hey,

I need help with something. Can anyone show me how to assign every player in a server with a random ID, from 0 to however many players there are? I'm trying not to use a loop that keeps going around until everyone has a unique ID.

Thanks
Reply
#2

Update :

Код:
	for(new i = 0; i<MAX_PLAYERS; i++)
	{

		for(new p = 0; p<MAX_PLAYERS; p++)
		{
		  for(new a = 0; a<MAX_PLAYERS; a++)
		  {
		    if(gPlayerData[p][ID] == 255)
		    {
					gPlayerData[p][ID] = a;
				}
			}
		}
	}
It's a bit messy, but I think that'll do the job (ID 255 is used to show that the player has no ID)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)