define/variable
#8

Quote:
Originally Posted by DowNlOaD_
i mean something like this
pawn Код:
#define MAX_PLAYERS               PlayersOnline()
and PlayersOnline() returns the number of players on server
You cant really do it like that due to one thing: Arrays. Functions can not be used outside of callbacks, so if any MAX_PLAYER arrays are declared globally, it'll crash the compiler.

You could go like:

Код:
#if defined MAX_PLAYERS
	#undef MAX_PLAYERS
#endif

#define MAX_PLAYERS 150
Which would make loops a lot faster, and would cut down on ram ussage (providing you dont use pvars). But thats as far as it goes tbh.


EDIT: Ohh i see what you meant, i thought you meant redefine MAX_PLAYERS to the GetMaxPlayers() value. My fault lol.


You dont need that function btw, just use the variable itself for what ever your doing.
Reply


Messages In This Thread
define/variable - by DowNlOaD_ - 16.06.2010, 18:45
Re: define/variable - by (SF)Noobanatior - 16.06.2010, 18:47
Re: define/variable - by Kyosaur - 16.06.2010, 18:49
Re: define/variable - by DowNlOaD_ - 16.06.2010, 18:54
Re: define/variable - by (SF)Noobanatior - 16.06.2010, 18:57
Re: define/variable - by DowNlOaD_ - 16.06.2010, 18:59
Re: define/variable - by (SF)Noobanatior - 16.06.2010, 19:02
Re: define/variable - by Kyosaur - 16.06.2010, 19:02
Re: define/variable - by DowNlOaD_ - 16.06.2010, 19:07
Re: define/variable - by Kyosaur - 16.06.2010, 19:14

Forum Jump:


Users browsing this thread: 1 Guest(s)