Random ID - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random ID (
/showthread.php?tid=106578)
Random ID -
Striker_Moe - 04.11.2009
Hi.
Is there any way to select a RANDOM ID?
Thanks.
Re: Random ID -
Kurence - 04.11.2009
new playa;
playa = random(MAX_PLAYERS);
if(IsPlayerConnected(playa)) Kick(playa);
-This will kick random player
Re: Random ID -
saiberfun - 04.11.2009
Quote:
Originally Posted by Kurence
new playa;
playa = random(MAX_PLAYERS);
if(IsPlayerConnected(playa)) Kick(playa);
-This will kick random player ![Cheesy](images/smilies/biggrin.png)
|
lol would be useless but yes that's right^^
you could do
new playa = random(MAX_PLAYERS);
instead tho
Re: Random ID -
Kurence - 04.11.2009
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 ![Cheesy](images/smilies/biggrin.png)
|
lol would be useless but yes that's right^^
you could do
new playa = random(MAX_PLAYERS);
instead tho ![Smiley](images/smilies/smile.png)
|
i don't like it
Re: Random ID -
Streetplaya - 04.11.2009
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
Re: Random ID -
saiberfun - 04.11.2009
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.