Difference between revisions of "ScriptHook: Console Commands"
From Nomad DB
m (Administrator moved page WD2 ScriptHook: Console Commands to ScriptHook: Console Commands) |
|||
Line 1: | Line 1: | ||
− | The [[ | + | The [[ScriptHook: Console|ScriptHook Console]] can be extended by custom commands from [[ScriptHook: Script|Scripts]]. '''A full example for a custom command can be found [[ICommandRegistry:AddArgument|here]].''' |
== Short Example == | == Short Example == | ||
Line 14: | Line 14: | ||
== Related Pages == | == Related Pages == | ||
− | * [[ | + | * [[ScriptHook: Console]] |
* [[ScriptHook.RegisterCommand]] | * [[ScriptHook.RegisterCommand]] | ||
− | [[Category: | + | [[Category:ScriptHook]] |
Revision as of 12:28, 6 October 2020
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)
end
local my_cmd = ScriptHook.RegisterCommand("my_cmd", my_callback)
my_cmd:AddArgument("arg1", true, CommandArgumentType.Any)