Page 1 of 1

How to Get a random player number

Posted: Sun Mar 10, 2013 6:13 pm
by ibm5155
Hi, so I need something to get a random player in game to print on the screen, and i don´t know how to do it :s

ex:

players playing:player1 ,player2, player3

then the mensage "player2 will receive the super shotgun, run!!!"

I think PlayerInGame could help with that but it´s limited to 8 players? O_o

RE: How to Get a random player number

Posted: Sun Mar 10, 2013 7:00 pm
by Dusk

Code: Select all

int player;

do {
	player = random (0, 63);
} while (!PlayerInGame (player));
Make sure PlayerCount is not 0 before you do that, though or you'll end up in an infinite loop.

RE: How to Get a random player number

Posted: Sun Mar 10, 2013 8:18 pm
by ibm5155
Wow it really worked thanks Dusk, now I get it how to right use playeringame :D