Posts: 3,004
Threads: 12
Joined: May 2011
Quote:
Originally Posted by [H]ead
Random Player Without params:
pawn Код:
getRandomPlayer() { #if defined MAX_PLAYERS #undef MAX_PLAYERS #endif
#define MAX_PLAYERS (DEFINE SLOTS HERE PLEASE)
static p[MAX_PLAYERS] a ;
for(new i = 0, a = -1; i != MAX_PLAYERS; ++i) if(IsPlayerConnected(i)) { p[++a] = i; }
return a == -1 ? -1 : p[random(a)]: }
With params MAX and MIN playerid:
pawn Код:
getRandomPlayer(max, min) { #if defined MAX_PLAYERS #undef MAX_PLAYERS #endif
#define MAX_PLAYERS (DEFINE SLOTS HERE PLEASE)
static p[MAX_PLAYERS] a ; max++;
for(a = -1; min != max; ++min) if(IsPlayerConnected(min)) { p[++a] = min; }
return a == -1 ? -1 : p[random(a)]: }
Cordially [ H]ead
|
can someone explane this?