Registering custom commands
A custom console command can be registered to expose additional functionality to the user or to other plugins. To register a command, use the RegisterCustomCommand
function:
void OnMyCommand(int fromTime, int toTime, const string&in commandLine, const array<string>&in args) {
log("My command was called with this command: " + commandLine + "!");
}
void Main() {
RegisterCustomCommand("my_command", "My command description", OnMyCommand);
}
A custom command stays registered until the plugin is deleted or removed. It is currently not possible to unregister a command programatically.
Registered commands function like any other built-in command, and can be used in the console or in other plugins via the ExecuteCommand
function.