Question about PVars
#1

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.
Reply
#2

Regular variables are faster, but PVars have other advantages

https://sampwiki.blast.hk/wiki/Per-player_variable_system
Reply
#3

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
Reply
#4

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
Reply
#5

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.
Reply
#6

Thanks for the answers
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)