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.

Hook into chat events from your own scripts.

Server-side

chatMessage (legacy, compatible)

Standard FiveM event — backwards-compatible.
Server
AddEventHandler('chatMessage', function(source, name, message)
    -- triggered for every message sent
end)
source
number
The sender’s server ID.
name
string
Sender display name (character name in roleplay, Steam name otherwise).
message
string
Raw message text (after color-code parsing).
Raw strings only. For rich payloads use fxChat:messageReceived below.

fxChat:messageReceived

Rich message event with the full options payload.
Server
AddEventHandler('fxChat:messageReceived', function(source, payload)
    -- payload.args, payload.title, payload.label, payload.color, etc.
end)
source
number
Sender server ID.
payload
object
Same shape as the options argument of addMessageargs, title, label, color, badge, special.
Example — log to your own analytics
AddEventHandler('fxChat:messageReceived', function(source, payload)
    MyAnalytics:track('chat_message', {
        playerId = source,
        message = payload.args,
        author = payload.title,
    })
end)

fxChat:playerMuted

Fired when a player is muted (manually or auto-muted by rate limiter).
Server
AddEventHandler('fxChat:playerMuted', function(source, durationMs, reason)
    -- ...
end)
source
number
Server ID of the muted player.
durationMs
number | nil
Mute duration in ms, or nil for permanent.
reason
string
"manual", "rate_limit", or "blacklist".

fxChat:playerUnmuted

Fired when a mute expires or is lifted.
Server
AddEventHandler('fxChat:playerUnmuted', function(source)
    -- ...
end)

Client-side

fxChat:opened

Fired when the chat input becomes focused (T pressed).
Client
AddEventHandler('fxChat:opened', function()
    -- pause your minigame, hide HUD, etc.
end)

fxChat:closed

Fired when chat input loses focus (ESC pressed or message sent).
Client
AddEventHandler('fxChat:closed', function()
    -- resume normal HUD
end)

fxChat:themeChanged

Fired when the active theme changes for this client (player picked a new one, or admin force-changed it).
Client
AddEventHandler('fxChat:themeChanged', function(themeName)
    print('Theme is now:', themeName)
end)
themeName
string
Filename without .json (e.g. "midnight").

Triggering events from your code

For most cases use the exports — but you can trigger these events manually if you need to.
TriggerEvent('fxChat:playerMuted', source, 60000, 'manual')
Triggering fxChat:messageReceived notifies listeners but doesn’t broadcast. Use addMessage to send a real message.