SA-MP Forums Archive
difference between those - 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: difference between those (/showthread.php?tid=635301)



difference between those - iBots - 05.06.2017

I would like to know the difference between these two things:
pawn Код:
GetPVarInt(playerid, "thename");
SetPVarInt(playerid, "thename", value);
and doing it like this:
pawn Код:
thename[playerid] = value;
//and to get the value you just type it in,like if(thename[playeird] == 2)
is there any difference,and could you explain a little bit about the PVar thingy?and Which method is better to use?


Re: difference between those - CheezIt - 05.06.2017

PVars are less efficient than variables, cells, arrays or whatever you want to call them. PVars are cross compatible, meaning if you set a specific PVar within a filterscript you can get that value within another filterscript or even within the gamemode (same goes for setting). Use PVars only for said scenario (if you want a stored value to be accessible within separate scripts while in runtime).

https://sampwiki.blast.hk/wiki/Per-player_variable_system