16.06.2010, 18:45
how can i make define to return variable?
#define MAX_PLAYERS PlayersOnline()
Originally Posted by DowNlOaD_
i mean something like this
pawn Код:
|
#if defined MAX_PLAYERS #undef MAX_PLAYERS #endif #define MAX_PLAYERS 150
Originally Posted by Kyosaur!!
Quote:
You could go like: Код:
#if defined MAX_PLAYERS #undef MAX_PLAYERS #endif #define MAX_PLAYERS 150 EDIT: Ohh i see what you meant, i thought you meant redefine MAX_PLAYERS to the GetMaxPlayers() value. My fault lol. |
Originally Posted by DowNlOaD_
Quote:
and at least PlayersOnline() works in loops PS: when i'm doing something like that: new VAR[PlayersOnline()]; it crashes my pawn compiler |
for(new i=0, p=GetMaxPlayers(); i<p; i++) { //stuff }Код:thats the way to do it, if your looking for the most efficient dynamic way. OFF TOPIC: As for your "new VAR[PlayersOnline()];" statement, i told you: You CANT use functions outside of callbacks.