CommandListener Typedef

Callback for command listeners. This is invoked whenever any command reaches the server, from the server console itself or a player.

Clients may be in the process of connecting when they are executing commands IsClientConnected(client) is not guaranteed to return true. Other functions such as GetClientIP() may not work at this point either.

Returning Plugin_Handled or Plugin_Stop will prevent the original, baseline code from running.

-- TEXT BELOW IS IMPLEMENTATION, AND NOT GUARANTEED -- Even if returning Plugin_Handled or Plugin_Stop, some callbacks will still trigger. These are: * C++ command dispatch hooks from Metamod:Source plugins * Reg*Cmd() hooks that did not create new commands.

typedef CommandListener = function Action(int client, const char[] command, int argc)



Client, or 0 for server. Client may not be connected or in game.


Command name, lower case. To get name as typed, use GetCmdArg() and specify argument 0.


Argument count.