random spectate?
#1

Random is 1 of the most weirdest things so far lol
and as duffy said

Quote:

(22:21:46) (Duffy) functions in scripts that are "random" are probably the most clever things ever created
(22:22:04) (Duffy) because computers are so systematic and mathematical its amazing how they can select something at random



But i want to do a randomw spectat( so you could be spectating a random player ) anybody any idea how you do this?
Reply
#2

anybody
Reply
#3

Код:
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];
}
I take no credit for this, but it is a function that I have stored.
Reply
#4

EDIT:already fixed
sorry for this post
Reply
#5

line new yplayer[MAX_SLOTS+1]; gives lots of erros like it doesnt know max_slots

How do i get this to work:S a define doesnt work either for max slots
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)