Define a VALUE not variable.
#2

If we're on the same page here. The reason why you can't change the value of what is defined is because when you define something globally it is stored in the memory when the script is initialized. Changing the value of the variable afterwards will make no difference.

I've been thinking and honestly... I have NO idea why you would want to do this?! Why not just use a variable? The only real reason why people use the define is to make scripting a large script simpler or avoiding repeating calculations or values (like with the DCMD definition). Instead of remembering the integer, you define it to an alpha numeric value which allows global use of it easier, and allows to change one value and altering all of the values instead of changing it everytime its used.

Eg. #define MAX_PLAYERS 200

The only reason it's there is because its simpler, and easier to change/edit. Instead of:

pawn Код:
for(new i = 0; i<200; i++)
// you do...
for(new i = 0; i<MAX_PLAYERS; i++)
Perhaps if you elaborated on what you want to do exactly, I could understand what it is exactly you want.
Reply


Messages In This Thread
Define a VALUE not variable. - by pyrodave - 15.08.2009, 15:30
Re: Define a VALUE not variable. - by [BDC]Scarface - 15.08.2009, 16:59
Re: Define a VALUE not variable. - by pyrodave - 15.08.2009, 17:29
Re: Define a VALUE not variable. - by Cueball - 16.08.2009, 00:51
Re: Define a VALUE not variable. - by pyrodave - 16.08.2009, 11:09
Re: Define a VALUE not variable. - by paytas - 16.08.2009, 11:19

Forum Jump:


Users browsing this thread: 1 Guest(s)