SA-MP Forums Archive
What is a static variable? - 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: What is a static variable? (/showthread.php?tid=371922)



What is a static variable? - Shetch - 24.08.2012

Hey there!
I have a question for you guys.

I saw this in a count down tutorial:
Код:
static amount;
It says that it creates a variable in which you can store a value.
Why couldn't I just use:
Код:
new ammount;
?


Re: What is a static variable? - Camacorn - 25.08.2012

You can read about the differences on the SA:MP wiki.

Link: https://sampwiki.blast.hk/wiki/Scripting_Basics#Scope


Re: What is a static variable? - Arca - 25.08.2012

A static variable is a type of variable whose lifetime extends across the entire script. It doesn't forget it's old value.