The amount of memory you occupy by doing:
Code:
new nVar[MAX_PLAYERS][MAX_VARS][MAX_VARNAME];
new iVar[MAX_PLAYERS][MAX_VARS][MAX_VARINPUT]
is very expensive. If more than one plugin uses this system, you are now multiplying this memory usage by the number of plugins.
Also, having to look up a string within MAX_VARS before you can get/set a variable, makes these operations expensive too. Converting integers and floats to strings and back makes it even worse. Referencing/setting a variable is very fast in pawn; this system adds extra native calls for these simple operations.
The "ease of use" for "not creating" the variables is greatly outweighed by the extra memory and operations included in this system.
Other suggestions:
The
copy native should be used where you are not formatting.
Your set Int/Float only support numbers of lengths 15 and 20 respectively, but it should support MAX_VARINPUT (though you would not need it).
Code:
#if defined MAX_PLAYERS
#undef MAX_PLAYERS
#endif
#define MAX_PLAYERS 32
->
Code:
#if !defined MAX_PLAYERS
#define MAX_PLAYERS 32
#endif
You should not empty strings like this:
Code:
nVar[playerid][i] = ""
instead use:
Code:
nVar[playerid][i][0] = EOS
Look into Tries: