AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Define, changing values (https://forums.alliedmods.net/showthread.php?t=19389)

Stormsys 10-15-2005 18:04

Define, changing values
 
ok hi, im new to amx scripting but its not all new to me verry simmiler to c++ and soon.


i have a question, ive defined a value

#define MAX_SOMETHING 10

if i later on want to chage the vale of that in my script can it be changed(i dnt think so), if not is there an ulternitive to define that works in the SAME way as a define.

becase just dooing MAX_SOMETHING = 20/ "20" give me errors
thanks

XxAvalanchexX 10-15-2005 18:16

#define's are used to define a word (MAX_SOMETHING) to a value (10). Every time MAX_SOMETHING appears in the script, regardless of whether or not it is used as a variable, it will be replaced with 10. These cannot be changed once they are created. What you want are variables:

Code:
new max_something = 10;

Stormsys 10-15-2005 18:25

yeh but thats why i asked for somthign that acts the same as a define a variable dosent.

new smallnum_num[MAX_NUM] = 0

then u get errors trying to do that....

XxAvalanchexX 10-15-2005 18:48

Pawn doesn't support dynamic arrays.


All times are GMT -4. The time now is 23:42.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.