Random Player Choosing
#1

I'm creating a gamemode.

Which selects Random Player to become one notorious gangster.

How can i make it?
Reply
#2

Use foreach. It has Iter_random() which is a very good way of doing this as it's very efficient (as foreach is as a whole).

https://sampforum.blast.hk/showthread.php?tid=92679
Reply
#3

is it something like Iter_Random(MAX_PLAYERS); ?
Reply
#4

Iter_Random(Player);

Literally 'Player' - not an ID or anything. Type EXACTLY that.
Reply
#5

So exactly something like this?

pawn Код:
new rando = Iter_Random(Player);

//Exmaple

GangLeader[rando] = 1;
Reply
#6

The random bit is okay, but the variable assignment seems wrong. Surely it'd be something like

pawn Код:
new randPlayer = Iter_Random(Player);

//Exmaple

GangLeader[GANG_BALLAS] = randPlayer;
Also, 'rando' is a very, uh, I don't know, it's just silly. Name things better.
Reply
#7

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)