Skip to main content

Documentation Index

Fetch the complete documentation index at: https://fxscripts.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

These exports run on the server. Most of what you’ll need lives here.

addMessage(target, options)

Send a chat message to one player or everyone. The most-used export.
Server
exports.fxChat:addMessage(target, options)
target
number | -1
required
Player server ID, or -1 to broadcast to every connected player.
options.args
string
required
The message text. Supports inline color codes and a small markdown subset (see below).
options.title
string
Author label. Usually a character name or system name.
options.label
string
Colored pill-style tag rendered before the title. Common uses: LSPD, EMS, ADMIN.
options.labelSecondary
object
Optional second tag, useful for badge numbers.
labelSecondary = { text = '42', color = '#00ff00' }
options.color
string
Author color (#hex). Falls back to the active theme’s accent.
options.badge
string
Built-in icon name, or any other string for plain text. Available icons: person, cloud, chat, envelope, megaphone, shield, heart, globe, alert, radio.
options.special
boolean
default:"false"
Adds a glow effect to highlight the message. Use sparingly.
options.tag
object
Override the visual tag entirely.
tag = { name = 'TAG', background = '#ff0000' }

Examples

System message
exports.fxChat:addMessage(source, {
    args = 'You picked up a wrench.',
    title = 'System',
})
Police broadcast with badge
exports.fxChat:addMessage(-1, {
    args = '10-91 in progress at Vespucci',
    title = 'Officer Smith',
    label = 'LSPD',
    labelSecondary = { text = '#247', color = '#9ca3af' },
    color = '#173ed9',
    badge = 'shield',
})
Special / glowing
exports.fxChat:addMessage(source, {
    args = '🏆 You won the round!',
    special = true,
    color = '#fbbf24',
})

Inline color codes

Two formats inside args:
-- SA:MP style ^N codes
args = 'Vehicle ^4stolen^0 at Vespucci'

-- HTML-style {#hex}text{/}
args = 'Vehicle {#FF5441}stolen{/} at Vespucci'
Both can be mixed in the same message. Available SA:MP codes are ^0 (reset) and ^1 through ^9.

Markdown

args = 'Type **bold**, __underline__, or use --- for a divider'
Markdown is parsed after HTML-escaping — XSS-safe.

clearChat(target?)

Clear chat history for one player or everyone.
Server
exports.fxChat:clearChat(target)
target
number | -1 | nil
Player server ID. Pass -1 or omit to clear chat for all players.
Examples
-- Clear for one player
exports.fxChat:clearChat(source)

-- Clear for everyone
exports.fxChat:clearChat(-1)

setMuted(target, muted, durationMs?)

Mute a player so their messages are silently dropped server-side.
Server
exports.fxChat:setMuted(target, muted, durationMs)
target
number
required
Player server ID to mute / unmute.
muted
boolean
required
true to mute, false to unmute.
durationMs
number
Optional auto-unmute delay in milliseconds. Omit for indefinite mute.
Examples
-- 5-minute mute
exports.fxChat:setMuted(source, true, 5 * 60 * 1000)

-- Permanent mute
exports.fxChat:setMuted(source, true)

-- Unmute
exports.fxChat:setMuted(source, false)

isMuted(target)

Check whether a player is currently muted.
Server
local muted = exports.fxChat:isMuted(target)
target
number
required
Player server ID.
returns
boolean
true if currently muted.

Missing an export you need? Ask in Discord — we ship new ones when there’s a real use case.