ScriptHook: Console Commands

From Nomad DB
Revision as of 23:04, 6 October 2020 by Deewarz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The ScriptHook Console can be extended by custom commands from Scripts. A full example for a custom command can be found here.

Short 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)

local my_cmd = ScriptHook.RegisterCommand("my_cmd", my_callback)
my_cmd:AddArgument("arg1", true, CommandArgumentType.Any)
my_cmd:SetDescription("This is my_cmd help text.")

Related Pages