View Single Post
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-24-2012 , 13:26   Re: [ANY] ConVar Suppression
Reply With Quote #9

Quote:
Originally Posted by KyleS View Post
I don't see this growing. I also didn't see a point in wasting arrays. If functionality has been lost as a result of this, please let me know. Upon request I can also totally add a verbose syntax checker.

If you have any further questions or concerns in regards to this plugin please let me know.
It's a matter of readability, not functionality. sCommand means 3 different things at different points:

1. The command name at the first ReplyToCommand.
2. The second argument at the StringToInt.
3. The first argument at the second, third, and fourth ReplyToCommands.

This is one of those things that makes maintenance programmers (want to) kill previous programmers.

Speaking of functionality, it might be a good idea to check if the ConVar exists (checking FindConVar against INVALID_HANDLE) before adding it to the trie, returning common.phrases's "Unable to find cvar" phrase if not found:
PHP Code:
// In OnPluginStart
    
LoadTranslations("common.phrases");

// in OnSupressConVar's case 0:
            
new Handle:convar FindConVar(sCommand);
            
            if (
convar == INVALID_HANDLE)
            {
                
ReplyToCommand(client"%s%t"PLUGIN_PREFIX"Unable to find cvar"sCommand);
                return 
Plugin_Handled;
            }
            else
            {
                
CloseHandle(convar);
            } 
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-24-2012 at 13:33.
Powerlord is offline