Commands

CLIENT & SERVER SIDE

Standalone, framework-agnostic solution designed to simplify the implementation of commands in your project. Uses SQL-based ranks to define access permissions. Commands can be assigned to specific ranks or left open (nil) for universal access.

Eliminates the need to define and maintain multiple command sets for different frameworks, offering developers a unified and centralized approach to command handling.

Client Functions

get_chat_suggestions

Manually get chat suggestions if required.

--- Utils object
utils.commands.get_chat_suggestions()

--- Direct export
exports.boii_utils:get_chat_suggestions()

Server Functions

register

Use the following to register a command on the server. Commands can either be open to all users or rank restricted through the provided user accounts database table. Command details have be specified above in example for easier readability.

--- Specify command name
local command_name = 'get_player_data'
--- Specify ranks or leave nil/null for open to all
local ranks = { 'dev' }
--- Specify help text
local help_text = 'Get a players player data by their id.'
--- Specify help params
local help_params = {
    { name = 'id', help = 'The players server ID.' }
}

--- Utils object
utils.commands.register(command_name, ranks, help_text, help_params, function(_src, args, raw)
    local player = utils.fw.get_player(_src)
    print('Player data:', json.encode(player)) 
end)

--- Direct export
exports.boii_utils:register_command(command_name, ranks, help_text, help_params, function(_src, args, raw)
    local player = utils.fw.get_player(_src)
    print('Player data:', json.encode(player)) 
end)

Last updated