Garry's Mod Wiki

concommand

The concommand library is used to create console commands which can be used to network (basic) information & events between the client and the server.

Methods

concommand.Add( string name, function callback, function autoComplete = nil, string helpText = nil, number flags = 0 )
Creates a console command that runs a function in lua with optional autocompletion function and help text. This will fail if the concommand was previously removed with concommand. Remove in a different realm (creating a command on the client that was removed from the server and vice-versa). Issue Tracker: 1183
table concommand.AutoComplete( string command, string arguments )
This is used internally - although you're able to use it you probably shouldn't. Used by the engine to call the autocomplete function for a console command, and retrieve returned options.
table, table concommand.GetTable()
Returns the tables of all console command callbacks, and autocomplete functions, that were added to the game with concommand. Add.
concommand.Remove( string name )
Removes a console command. concommand. Add will fail if the concommand was previously removed with this function in a different realm (creating a command on the client that was removed from the server and vice-versa). Issue Tracker: 1183
boolean concommand.Run( Player ply, string cmd, any args, string argumentString )
This is used internally - although you're able to use it you probably shouldn't. You might be looking for RunConsoleCommand or Player:ConCommand. Used by the engine to run a console command's callback function. This will only be called for commands that were added with AddConsoleCommand, which concommand. Add calls internally. An error is sent to the player's chat if no callback is found. This will still be called for concommands removed with concommand. Remove but will return false.