About
The chat resource renders FiveM’s built-in NUI chat box and exposes events and exports for sending messages, registering command suggestions, defining reusable HTML templates, and hooking outgoing messages. It is included and maintained at the cfx-server-data repository.
Exports
Client
addMessage- Adds a message to the local player’s chataddSuggestion- Adds a command suggestion to the local player’s chat
Server
addMessage- Sends a message to a target player’s chatregisterMessageHook- Registers a hook that can modify or cancel outgoing messages before they’re sentregisterMode- Registers a custom chat mode
Events
Client
chat:addMessage- Sends a chat message to the local clientchat:addSuggestion- Adds a single command suggestionchat:addSuggestions- Adds multiple command suggestions in one callchat:removeSuggestion- Removes a previously added command suggestionchat:addTemplate- Registers a reusable HTML message templatechat:clear- Clears the chat historychatMessage- Deprecated client-side; usechat:addMessageinstead
Server
chatMessage- Fires when a player sends a chat message, letting the server read, log, or reply to it