ScriptHook: Console Commands
From Nomad DB
Revision as of 11:32, 15 April 2020 by Jan (talk | contribs) (Created page with "The ScriptHook Console can be extended by custom commands from Scripts. This guide will show you how to register these c...")
The ScriptHook Console can be extended by custom commands from Scripts. This guide will show you how to register these commands and impement validating arguments.
Example
The following snippet will register the console command my_cmd <arg1>.
local function my_callback(arg1)
print("Hello from my_cmd")
print("arg1: ", arg1)
end
local my_cmd = ScriptHook.RegisterCommand("my_cmd", my_callback)
my_cmd:AddArgument("arg1", true, CommandArgumentType.Any)