Which one is the best? PlayerInfo or GetPVarInt
#1

Which one is the best? PlayerInfo or GetPVarInt ?
Comment.
Reply
#2

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)
Reply
#3

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

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

If you're asking this, then you probably don't need (G/S/P)Var.
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)