Command flags - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Discussion (
https://sampforum.blast.hk/forumdisplay.php?fid=84)
+---- Thread: Command flags (
/showthread.php?tid=620195)
Command flags -
Stinged - 27.10.2016
Having flags in command processors is great.
Before Pawn.CMD's release, I used to create admin commands using a special macro that checks for the admin level.
Pawn.CMD (And SmartCMD now) made it simpler by adding bit flags to any command.
But I was wondering, isn't it (more optimized)/faster to do the
admin if-checks (for example), in admin commands only,
instead of checking the flags of every command that is processed?
Re: Command flags -
Yashas - 27.10.2016
Firstly, the upgrade/downgrade is negligible.
Secondly, it makes your code tidier.
By doing the check in OnPlayerCommandReceived callback, you avoid the command function call and also the OnPlayerCommandPerformed function call. You are saving two function calls.
Whatever the change in performance may be, it is so negligible that you won't even save 1ms after running the server for a whole day.
Re: Command flags -
Stinged - 27.10.2016
Quote:
Originally Posted by Yashas
Firstly, the upgrade/downgrade is negligible.
Secondly, it makes your code tidier.
By doing the check in OnPlayerCommandReceived callback, you avoid the command function call and also the OnPlayerCommandPerformed function call. You are saving two function calls.
Whatever the change in performance may be, it is so negligible that you won't even save 1ms after running the server for a whole day.
|
Okay, thanks!