SA-MP Forums Archive
PVar or 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: PVar or Variables? (/showthread.php?tid=368787)



PVar or Variables? - Admigo - 14.08.2012

Heey all,

My whole script is bugged so i am debugging it.
I am using much variables.
Whats better to use: Variables or Pvar?

Thanks Admigo


Re: PVar or Variables? - Gumica - 14.08.2012

Variables of course
Reason is here:
https://sampforum.blast.hk/showthread.php?tid=268499


Re: PVar or Variables? - Babul - 14.08.2012

i have to admit: i was (still am indeed) using PVars for almost every variable. they are "slower", we ALL know that, but is listing 100 variables once per 4 seconds worth a /cry? it will not harm your server performance if you load a debug filterscript, handle some checks (your admin level==16? interior set properly?) with pvars.
if you script each single variable like
Код:
if(GotShit#1[playerid]>0) blablaa
if(GotShit#2[playerid]<4)blabla else something else blabla
if(GotEvenMoreAwesomeShit[playerid] equals blabla2 etcetcetc
this list could go on for 200 variables, its a fucking hazzle to manage all of them,
OR:
one single loop using GetPVarsUpperIndex(), maybe a proper dialog input+response.if you are done debugging, unload the filterscript which handles pvars. done.

to all who are complaining about the bad performance of PVars: try to script your own system which enables all scripts to access them. no file operations allowed = you'll fail.
i sometimes wonder why theyre got invented. to be ignored, i guess...


Re: PVar or Variables? - playbox12 - 14.08.2012

It really depends on the situation, you can script some very neat things while combining pvars and gvars, properties. I use pvars in situations where I don't know how much of something there will be and don't really want a set limit.


Re: PVar or Variables? - Admigo - 14.08.2012

Okay and what about my script? Should i place all codes in gamemode or make filterscripts to?


Re: PVar or Variables? - Babul - 14.08.2012

start with the gamemode itself. as soon you see "oh, this command/skill should be placed in the adminscript", then do that. tbh, i did it this way: move all shit from gamemode to a filterscript, then you are forced to use G/P vars. if that works, you may move some code which unlikely will be changed, back to the gamemode.