Random choose player
#1

Hello,

I'm making a script, which choose a random player every 5 minutes, and other players have to kill him for money.
The only thing i can't make in it is to choose the random playerid, and put this value into MarkedPlayer[MAX_PLAYERS].

Any ideas? :P
Reply
#2

pawn Код:
stock GetRandomPlayer()
{
  new yplayer[MAX_PLAYERS+1];
  for (new y = 0; y != MAX_PLAYERS; y ++) {
    if (IsPlayerConnected(y)) {
      yplayer[0] ++;
      yplayer[yplayer[0]] = y;
    }
  }
  return yplayer[random(yplayer[0])+1];
}
Reply
#3

thanks a lot
Reply
#4

No problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)