Question about Variables
#7

Quote:
Originally Posted by SEnergy
View Post
yes, local variables (declared within a function) are destroyed after function ends, if you create new variable with same name it will remember it's value from previous declaration, therefore you don't need to have global variables but you can create static variables everytime you want to use them
Alright thanks. RPed+.
Quote:
Originally Posted by Dan.
View Post
Targetid is a variable in your code, so change:
pawn Code:
Targetid[24];
to:
pawn Code:
Targetid;
Thanks for fixing this one i got it fixed on my script was just giving an example here

Quote:
Originally Posted by oKzrh
View Post
If your variable is inside your command (as you've showed to us) Than it won't be a global variable that you can actually use in your script.
In the top of your mod, under all of your includes, defines, etc... Where you probably have variables there, just add the "Money" variable, and then you'll be able to use it in your whole script, without using stating it as a new ("new") variable each time .
Thank you , i'll add them in the top of my script because i've got a lot of variables though , converting them to static would take some time.

RPed+
Reply


Messages In This Thread
Question about Variables - by CoDeZ - 02.08.2012, 11:17
Re: Question about Variables - by SEnergy - 02.08.2012, 11:18
Re: Question about Variables - by CoDeZ - 02.08.2012, 11:22
Re: Question about Variables - by SEnergy - 02.08.2012, 11:24
Re: Question about Variables - by Dan. - 02.08.2012, 11:25
Re: Question about Variables - by oKzrh - 02.08.2012, 11:25
Re: Question about Variables - by CoDeZ - 02.08.2012, 11:27
Re: Question about Variables - by oKzrh - 02.08.2012, 11:31
Re: Question about Variables - by Misiur - 02.08.2012, 11:45

Forum Jump:


Users browsing this thread: 3 Guest(s)