Posts: 262
Threads: 51
Joined: May 2014
Reputation:
0
Which one is the best? PlayerInfo or GetPVarInt ?
Comment.
Posts: 1,290
Threads: 69
Joined: Dec 2006
Reputation:
0
GetPVarInt is certainly slower, but uses less memory I guess
Edit: PVars are also reset to 0 when then player disconnects, so no need to reset them in OnPlayerConnect (unless they need to be set to something other than 0)
Posts: 4,878
Threads: 85
Joined: Jun 2007
Reputation:
0
PVars store the value AND the identifier, so they actually use more memory. Only reason I can think of right now is to use them for cross-script variables, or maybe for stuff that gets accessed just very rarely. Whenever you can use just normal variables.
Posts: 1,801
Threads: 21
Joined: Mar 2008
Reputation:
0
PVars are, like Mauzen said, only really useful for adding new variables run-time and for cross-script variables.
There's literally no advantage over regular variables in other scenarios (except that you can index PVars by a name, although that is rarely a requirement).
Posts: 3,004
Threads: 12
Joined: May 2011
If you're asking this, then you probably don't need (G/S/P)Var.
Posts: 155
Threads: 36
Joined: Oct 2016
Reputation:
0
pVars for me is good to know it can be very important sometimes down the line but for me its easy to put few variables in an enumeration than adding a new variable for the maximum amounts of players MAX_PLAYERS i usual learn'd quite well and i'm practical using it.