AddCommandListener Function

Adds a callback that will fire when a command is sent to the server.

Registering commands is designed to create a new command as part of the UI, whereas this is a lightweight hook on a command string, existing or not. Using Reg*Cmd to intercept is in poor practice, as it physically creates a new command and can slow down dispatch in general.

To see if this feature is available, use FeatureType_Capability and FEATURECAP_COMMANDLISTENER.

bool AddCommandListener(CommandListener callback, const char[] command)


CommandListener callback


const char[] command

Command, or if not specified, a global listener. The command is case insensitive.

Return Value

True if this feature is available on the current game, false otherwise.