18.07.2013, 09:43
I agree that beginners need to be told about more efficient ways to handle commands, but the command "processors" that use CallLocalFunction only become favorable when there are more commands than just a few. CallLocalFunction, too, uses string comparisons, but does it using binary search resulting in logarithmic compexity. But it does not search from amongst your commands, but all public functions registered with the AMX (everything such as native callbacks, timers, etc. are included in the search).
So for just a few commands I would favor using string comparisons in OnPlayerCommandText. Especially when the code is created by or for beginners who could find the idea of callback hooking or includes confusing!
So for just a few commands I would favor using string comparisons in OnPlayerCommandText. Especially when the code is created by or for beginners who could find the idea of callback hooking or includes confusing!