Question about PVars - 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: Question about PVars (
/showthread.php?tid=347614)
Question about PVars -
Dodo9655 - 02.06.2012
Hello, what is the difference between using PVars (like SetPVarInt, GetPVarInt... etc) and using the classic way with enum and player[id][var].
Which one do you recommend?
Thanks.
Re: Question about PVars -
MadeMan - 02.06.2012
Regular variables are faster, but PVars have other advantages
https://sampwiki.blast.hk/wiki/Per-player_variable_system
Re: Question about PVars -
ReneG - 02.06.2012
One main advantage to using PVars is that you don't have to reset them once a player disconnects, but they do use up more ram than regular variables.
Here is a thread that ****** wrote that briefly covers PVars.
https://sampforum.blast.hk/showthread.php?tid=268499
Re: Question about PVars -
Niko_boy - 02.06.2012
a Pvar can also be USED remotely
i.e. if once used
SetPVarInt(playerid , "score" , playerscore);
you can just use Variables " Score " using GetPVarInt in any other script too which running side by side of server,
< though thats not recommeded by some ppl >
WHile this not possible with normal variables ...
to do it with them you need some public functions etc.. and CallRemoteFunction
Re: Question about PVars -
MP2 - 02.06.2012
You shouldn't use pVars for everything, and shouldn't use variables/arrays/enums for everything. Arrays should alwatys use 'normal' variables, and IMO often-accessed variables that don't need to be used in remote scripts shouldn't be pvars, for example a variable that is used in OnPlayerUpdate.
Re: Question about PVars -
Dodo9655 - 02.06.2012
Thanks for the answers