21.01.2013, 13:56
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?
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?