Doubt with per player variable system (PVar)
#1

In the wiki article about this (https://sampwiki.blast.hk/wiki/Per-player_variable_system) you can see that PVars are shared by the gamemode and all the filterscripts running in your server. This can be an advantage when you want them to work together intentionally, but I also see a risk in this:
Imagine two scripters, scripter A and scripter B, who have absolutely no relationship with each other. Scripter A releases a gamemode which uses a PVar (for example, SetPVarInt "LastVehicle"), and scripter B releases a filterscript which, by pure coincidence, uses another PVar that has the very same name. Now we have a random user who coincidentally downloads both that gamemode and that filterscript, without knowing at all that they both have a PVar with the same name, and he puts both together in his server. Obviously there would be an interference. However, if you use the old MAX_PLAYERS sized arrays method, even if they have the very same name in gamemode and filterscripts, they will be completely independent.

So my question is: is there any way to isolate PVars so they affect only the gamemode or filterscript in which they are used? Or the only option I have to avoid interference is to give my PVars some very strange names that nobody else will ever give to his?
Reply
#2

Wrong Section, This should be in the discussion part of the forum and not the scripting help.
Reply
#3

Then in most cases PVars are unnecessary if you only use it for one script.
Maybe reading this can help you: https://sampforum.blast.hk/showthread.php?tid=268499
Reply
#4

Quote:
Originally Posted by leong124
Посмотреть сообщение
Then in most cases PVars are unnecessary if you only use it for one script.
Maybe reading this can help you: https://sampforum.blast.hk/showthread.php?tid=268499
Wow, that was really useful!!
Thank you a lot.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)