So I found a plugin a while ago that does exactly what I want, sort of...
It's simple-chatcolors, and I noticed that it loads the KeyValues file every check, which seems extremely inefficient, and probably could be cached.
The basics go like this...
Player connects, calls CheckPlayer, CheckPlayer then loads the file into a KeyValue handle, and loops through checking admin flags/etc, and finally creating a Trie from the data, and then setting the client index in a Handle to that trie data, which is then used when the player talks.
I'm in the process of rewriting this a bit, and thought it would be a bit better to store it in some kind of array based on group name (I will be removing the 'flag' checking system for some group name check), but I'm a little stuck with how to load the config once and then go back to the data...
I basically need to store the data in a Key Value map of some sort, with the key being the group name, and value being the already loaded Trie (No reason to reload, it is an extremely simple concept).
So, is there any data type that would let me do this efficiently? I don't want to have to go back and load everything every player connect/construct a new trie every connect...
Please note, the trie value will be reused and mapped to any player who connects (If it is not possible to reuse these, I could always clone them, please let me know), and unmapped from that player when they disconnect...
Any suggestions would help me greatly, I know plenty of other languages to fix any problems, however I am unfamiliar with the sourcemod scripting language and it's data types...
|