Server

RegCommand

Function to register a command with multiple options such as suggestions, more return value in the callback function for better optimization when using different player informations

function HRLib.RegCommand(
    name: string|string[],
    accessFromConsole: boolean?,
    accessFromInGame: boolean?,
    cb: fun(
        args: string[]|{},
        rawCommand: any,
        IPlayer: HRLibClientIPlayer,
        FPlayer: HRLibClientFPlayer
    ),
    suggestions: {
        help: string?,
        isRestricted: boolean?,
        args: { name: string, help: string }[]
    }
)

Parameters description

  • name - the command name, has the option to enter multiple names for the same command in a list

  • accessFromConsole - sets whether or not the command is accessable from the txAdmin live console (from the server with no player focused)

  • accessFromInGame - sets whether or not the command is accessable from the players in the server

  • cb - the callback function to trigger when player triggers the command

  • suggestions - the command suggestions, command help and args help texts

Last updated