Chat Commands

Built-in and custom commands for player interactions.

Built-in Commands

/me [action]

Roleplay action visible to nearby players.

Config.Commands.me = {
    enabled     = true,
    command     = "me",
    description = "In-character roleplay action",
    range       = 10.0,        -- How far away players can see
    los         = true,        -- Require line-of-sight
    bubble      = false,       -- Use 3D bubble or chat
    badge       = {
        label = 'ME',
        color = '#E8A838'
    },
    author      = '{Framework:GetName}',
}

Example: /me pulls out a gun → Other players see your character's action

/do [description]

Describe the environment or an object.

Config.Commands.do_ = {
    enabled     = true,
    command     = "do",
    description = "Describe the environment",
    range       = 10.0,
    los         = true,
    bubble      = true,       -- Usually shown as 3D bubble
    badge       = { label = 'DO', color = '#5B8DD9' },
    author      = '{Masked:Framework.Functions.GetPlayerName}',
}

Example: /do the store is closed → Visible to nearby players

/ooc [message]

Out-of-character chat (meta discussion).

Config.Commands.ooc = {
    enabled     = true,
    command     = "ooc",
    description = "Out-of-character chat",
    range       = 50.0,       -- Longer range than /me
    author      = '{Framework.Functions.GetPlayerName}',
}

/msg [id] [message]

Private message to another player.

Config.Commands.msg = {
    enabled     = true,
    command     = "msg",
    description = "Private message · /msg [id] [text]",
    author      = '{Framework.Functions.GetPlayerName}',
}

Example: /msg 5 Hey, where are you? → Only player 5 sees it

/twitter [text]

Post to global Twitter feed.

Config.Commands.twitter = {
    enabled     = true,
    command     = "twitter",
    channel     = "twitter",
    description = "Post a tweet",
    author      = '{Framework.Functions.GetPlayerName}',
}

Example: /twitter Looking for a taxi! → All players see it

/dice [max]

Roll dice and broadcast result.

Config.Commands.dice = {
    enabled     = true,
    command     = "dice",
    description = "Roll the dice · /dice [max]",
    range       = 15.0,
}

Example: /dice 20 → Rolls 1-20, shows to nearby players

/try [action]

Attempt an action with 50/50 success/fail.

Config.Commands.try = {
    enabled     = true,
    command     = "try",
    description = "Attempt an action · /try [action]",
    range       = 15.0,
}

Example: /try to pick the lock → Shows "succeeded" or "failed"

/adminchat [message]

Admin-only channel.

Config.Commands.adminchat = {
    enabled     = true,
    command     = "adminchat",
    channel     = "admin",
    description = "Admin chat",
}

Job Whisper Commands

Role-specific radio/dispatch channels:

Config.JobWhisper = {

    policeRadio = {
        enabled     = true,
        command     = "r",
        description = "Police radio",
        channel     = 'police',
        template    = T.Presets.jobWhisper('RADIO', '#3498db'),
        sender      = { job = "police", grade = 0 },
        receivers   = {
            { job = "police", grade = 0 },
        },
    },

    policeDispatch = {
        enabled     = true,
        command     = "despacho",
        description = "Police dispatch to EMS",
        channel     = 'police',
        template    = T.Presets.jobWhisper('DESPACHO', '#e67e22'),
        sender      = { job = "police", grade = 0 },
        receivers   = {
            { job = "police", grade = 0 },
            { job = "ambulance", grade = 0 },
        },
    },

}

Example: /r All units, robbery in progress at bank

Command Configuration Options

Visibility Control

range = 10.0,      -- Proximity range in metres
los = true,        -- Require line-of-sight (can't see through walls)
area = true,       -- Area-restricted (uses areaRadius)
areaRadius = 50.0, -- Area size in metres

Display Options

badge = {
    label = 'ME',           -- Text on badge
    color = '#E8A838'       -- Badge color
},
author = '{Framework:GetName}',  -- Who sent it (placeholder)
channel = 'police',              -- Channel assignment

Visibility Modifiers

Use placeholders to mask identity:

  • {Framework:GetName} - Real name (unmasked)
  • {Masked:Framework.Functions.GetPlayerName} - Shows "Anonymous" if masked
  • {Friends:Framework.Functions.GetPlayerName} - Shows name only to friends

Enable/Disable Commands

Disable a command globally:

Config.Commands.me.enabled = false

The command won't be available and won't appear in suggestions.

Command Processing Steps

Messages go through several steps:

  1. Command parse - /me does something
  2. Author resolve - Get player's name/character
  3. Visibility check - Are targets nearby? Can they see?
  4. Template render - Apply command's template
  5. Display - Show in player's chat

Creating Custom Commands

Create commands in config/commands/client.lua:

Commands.client("greet", {
    requireLoaded = true,
    handler = function(ctx)
        if ctx.message == "" then return end
        -- ctx.author = player name
        -- ctx.message = everything after command
        -- ctx.range = proximity range from config
        Commands.sendProximity('cmd:me', { ctx.author, "waves hello" }, ctx.range)
    end,
})

For server-side commands, use config/commands/server.lua:

Commands.server("announce", {
    requireAdmin = true,
    handler = function(ctx, source)
        TriggerClientEvent('chat:addMessage', -1, {
            templateId = 'announce',
            args = { ctx.message }
        })
    end,
})

Job Ads System

Allow specific job grades to post announcements:

Config.JobAds = {
    {
        job         = "police",
        description = "Job ad description",
        command     = "policeads",
        grade       = { 0, 1, 2 },     -- Grades 0, 1, 2 can post
        template    = "dont_register:police_ad",
        visibility  = { "all" }
    }
}

Command: /policeads message here

Templates
../templates/
Channels
../channels/
Placeholders
../placeholders/