SA-MP Forums Archive
Pvar or global 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Pvar or global variable? (/showthread.php?tid=222612)



Pvar or global variable? - -Rebel Son- - 07.02.2011

Well, deciding between using Pvar or a global variable.

like..

SetPVar Kills

or..

new Kills[MAX_PLAYERS]

or...

using my account system to save it.

enum
kills
-

Witch would be more relieable.


Re: Pvar or global variable? - xRyder - 07.02.2011

I would go with PVars.


Re: Pvar or global variable? - Calgon - 07.02.2011

See here.


Re: Pvar or global variable? - MrDeath537 - 07.02.2011

PVars are slower, but they use less memory. Global variables are faster, and they use memory.

I'm using global variables in a lot of things, and using PVars in some circumstances (such as Strings)


Re: Pvar or global variable? - -Rebel Son- - 07.02.2011

Alright, sounds sexy.


Re: Pvar or global variable? - Unknown123 - 07.02.2011

Yeah, i agree with MrDeath.


Re: Pvar or global variable? - _Tommy - 07.02.2011

If you want to save user's stats and change them in the future, use global vars. I'm suing PVars for smaller things, like a one-time restore of a variable(Health,ID of a player, etc').

Edit: if you have already got an account system, USE IT! (enum)