Posts: 70
Threads: 0
Joined: Sep 2011
Reputation:
0
Advise use variable type static or global variable, once when GetPlayerIp reset string to allocate the player andress ip
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?
Double-O-Seven
Unregistered
Quote:
Originally Posted by ******
The PAWN implemetors guide, and modes compiled with the "-a" flag (output assembly instead of .amx).
|
I've edited settings.ini in the pawno folder and changed params=-r to params=-a but it still compiles as AMX and not as assembly, what the heck?
Double-O-Seven
Unregistered
In cmd.exe:
pawncc.exe JunkBuster.pwn -a
(moved JunkBuster.pwn to pawno folder)
Result:
http://www.sendspace.com/file/135jk9