Random ID
#1

Hi.

Is there any way to select a RANDOM ID?

Thanks.
Reply
#2

new playa;
playa = random(MAX_PLAYERS);
if(IsPlayerConnected(playa)) Kick(playa);
-This will kick random player
Reply
#3

Quote:
Originally Posted by Kurence
new playa;
playa = random(MAX_PLAYERS);
if(IsPlayerConnected(playa)) Kick(playa);
-This will kick random player
lol would be useless but yes that's right^^
you could do
new playa = random(MAX_PLAYERS);
instead tho
Reply
#4

Quote:
Originally Posted by ┤ŞąiBЄЯҒПŋ├
Quote:
Originally Posted by Kurence
new playa;
playa = random(MAX_PLAYERS);
if(IsPlayerConnected(playa)) Kick(playa);
-This will kick random player
lol would be useless but yes that's right^^
you could do
new playa = random(MAX_PLAYERS);
instead tho
i don't like it
Reply
#5

You can't do something like random(MAX_PLAYERS), as some player slots may be empty, see if there would be these players:
0 1 2 3 4 5 6

then player 2 and 4 disconnect, it looks like that now:
0 1 3 5 6

Reply
#6

Quote:
Originally Posted by ~MaVe
You can't do something like random(MAX_PLAYERS), as some player slots may be empty, see if there would be these players:
0 1 2 3 4 5 6

then player 2 and 4 disconnect, it looks like that now:
0 1 3 5 6

you can but it ain't the best way
just check if the player is connected if not call the function again
that would help the problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)