Skip to main content

console:registerMethod

warning

Console commands should be registered on the MOD:onInit() function

warning

The command id needs to be unique

void console:registerMethod(command, callback, description, flags)

Registers a new console command

console:registerMethod("my_command", function(args, userID)
if #args <= 1 then return false, "Missing arguments" end

console:print("Awesome " .. args[2], CONSOLE.LOG.DEBUG)
return true, "OK!"
end, "My command description", CONSOLE.FLAGS.CHEATS | CONSOLE.FLAGS.ADMIN) -- Admin only and requires cheats enabled

Parameters

TypeNameDescriptionOptional
stringcommandNo description
functioncallbackfun(args: string[], userID: number): success: boolean, msg: string
stringdescriptionNo description
CONSOLE.FLAGSflagsNo description