The server variable system (put short, SVar) is a new way of creating global server variables efficient and dynamically, meaning that they can be used in server's gamemode and filterscripts at the same time.
They are similar to PVars, but are not tied to a player ID.
This system was introduced in SA-MP 0.3.7 R2-1 and will not work in earlier versions!
The SVar system is the same as the PVars, although the variables created are server-wide, not attached to any player ID, and persist through gamemode changes.
SVars can be shared/accessed across gamemode scripts and filterscripts.
You can easily enumerate and print/store the SVar list. This makes debugging easier.
Even if a SVar hasn't been created, it still will return a default value of 0.
SVars can hold very large strings using dynamically allocated memory.
You can Set, Get, Create SVars ingame.
- SVars are several times slower than regular variables. It is generally more favorable to trade in memory for speed, rather than the other way round.
- SetSVarInt: set an integer for a server variable.
- GetSVarInt: get a player server as an integer.
- SetSVarString: set a string for a server variable.
- GetSVarString: get the previously set string from a server variable.
- SetSVarFloat: set a float for a server variable.
- GetSVarFloat: get the previously set float from a server variable
- DeleteSVar: delete a server variable.