Raised This Month: $ Target: $400
 0% 

Define, changing values


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stormsys
Member
Join Date: Oct 2005
Old 10-15-2005 , 18:04   Define, changing values
Reply With Quote #1

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
Stormsys is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-15-2005 , 18:16  
Reply With Quote #2

#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;
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Stormsys
Member
Join Date: Oct 2005
Old 10-15-2005 , 18:25  
Reply With Quote #3

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....
Stormsys is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-15-2005 , 18:48  
Reply With Quote #4

Pawn doesn't support dynamic arrays.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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