SA-MP Forums Archive
Methods and variables - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Methods and variables (/showthread.php?tid=423774)



Methods and variables - Syntax - 19.03.2013

My simple question is: What is the difference between methods and variables? Also, what is a value? Please elaborate each example/definition you may give me.

As a reward, you will be given a reputation point.


Re: Methods and variables - Jstylezzz - 19.03.2013

Alright, let's start with the beginning.
If you want to store data for as long as the script is running, you can use variables. A variable is just simply something that holds a value. A value can be, for example, 5. So, if I would have variable 'Coins', and the value of 'Coins' is 5, the variable 'Coins' is worth 5.
And, I'm not sure what you mean with method, but what I know under method, is the way you do something.


Re: Methods and variables - Syntax - 19.03.2013

Thank you so much. You have just been rewarded for that answer.


Re: Methods and variables - Vince - 19.03.2013

Pawn is a language that doesn't use classes and therefor it has no methods. A method is basically a function within a class.


Re: Methods and variables - Syntax - 19.03.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
Pawn is a language that doesn't use classes and therefor it has no methods. A method is basically a function within a class.
I have been told that I should learn what a method is. James, a very good friend of mine, is teaching me to script.