Documentation
  • 👋Introduction
  • 📚Guides
    • Useful Links
  • 🆓boii_utils
    • Installation
    • Configuration
    • Modules
    • API
      • Callbacks
      • Characters
      • Commands
      • Cooldowns
      • Debugging
      • Entities
      • Environment
      • Framework Bridge
      • Geometry
      • Items
      • Keys
      • Licences
      • Maths
      • Methods
      • Player
      • Requests
      • Strings
      • Tables
      • Timestamps
      • UI Bridges
      • Vehicles
      • Version
      • XP
      • UI Elements
Powered by GitBook
On this page
  • Server
  • register_command(command, required_rank, help, params, handler)
  • Client
  • get_chat_suggestions()
  1. boii_utils
  2. API

Commands

The Commands module provides a simple interface to register server commands with built-in permission checking and chat suggestions.


Accessing the Module

local COMMANDS <const> = exports.boii_utils:get("modules.commands")

Server

register_command(command, required_rank, help, params, handler)

Registers a new server command.

Parameters

Name
Type
Description

command

string

The command name to register (e.g., "/kick").

required_rank

`string

table`

help

string

Help text for the command (displayed in suggestions).

params

table

Array of parameter objects with name and help fields.

handler

function

Function to execute when the command is run. Signature: function(source, args, raw)

Example

COMMANDS.register("announce", "admin", "Broadcast a message to all players", {
    { name = "message", help = "The message to broadcast" }
}, function(source, args, raw)
    local message = table.concat(args, " ")
    TriggerClientEvent("chat:addMessage", -1, {
        args = { "^3Announcement", message }
    })
end)

Client

get_chat_suggestions()

Requests the server to send updated chat suggestions to the client.

Parameters

Name
Type
Description

None

-

This function takes no parameters.

Example

COMMANDS.get_chat_suggestions()
PreviousCharactersNextCooldowns

Last updated 1 month ago

🆓