Commands are easy to create and can be called from the console of the server or clients, they are mainly useful for administrative and debugging purposes.
Alternatively RPCs can be used to transmit data from the server to clients with lesser restrictions then commands.
Commands can be created on any static method by applying a method attribute
A ConCmd.Serverwill run on the server and can be executed by the server itself or any client. Within the method ConsoleSystem.Caller returns the client running the command, it will be null if the server has run the command itself or through rcon.
ConCmd.Admin can be used in place of ConCmd.Server - as the name suggests it ensures only admins can run this command.
ConCmd.Client runs on the client that runs it, this can be executed on the client by the server.
There is limited support for parameter types as they all need to be converted to a string and back - if you find this too limiting you should probably use RPCs instead.
The only supported parameter types are:
float, double, uint, int, bool, string
Obviously commands can be run directly from the server or client's console by name.
They can also be run with code:
ConsoleSystem.Run( string command, ) - this will run a console command on either the server or client.
Commands can also be called on a client from the server with Client.SendCommandToClient( string command ).
If you call a method marked with ConCmd.Server on the client then it will automatically call it as a console command.