From Nomad DB

Registers an argument to a Console Command. It is part of the ICommandRegistry interface that is returned by ScriptHook.RegisterCommand. Arguments support validation using CommandArgumentType enum. Arguments can also be marked as optional.


[command]:AddArgument(name[, required, type])
  • name (string) Argument name
  • Optional: required (boolean) Specifies whether the argument is required (default: true)
  • Optional: type (CommandArgumentType) Argument validation


In this example, we imagine a teleport <x> <y> <z> command. The x, y, z coordinates are marked as float to allow decimal representation.

local cmd_teleport = ScriptHook.RegisterCommand("teleport", [...])
cmd_teleport:AddArgument("x", true, CommandArgumentType.Float)
cmd_teleport:AddArgument("y", true, CommandArgumentType.Float)
cmd_teleport:AddArgument("z", true, CommandArgumentType.Float)

When executing the teleport command, the Console will validate if

  • all required arguments are given
  • the given arguments can be parsed as decimal values (float)

Related Pages