Skip to Content
ResourcesChatEventschatMessage: Server Routing Hook and Client Migration
Report an error
Open in ChatGPTOpen in Claude

chatMessage

The server and client forms have different roles. The stock chat server triggers a local routing hook with (source, author, text). The legacy client display form (author, color, text) is deprecated in favor of chat:addMessage.

Do not register a new network handler for the server hook merely to observe chat. The reviewed provider calls TriggerEvent('chatMessage', ...) and checks WasEventCanceled() before default delivery. A synchronous cancellation can therefore suppress that delivery; an asynchronous cancellation after the handler returns cannot undo it. This does not erase provider logs or copies retained elsewhere.

Prefer a real command for a command

For a new server.lua command, bypass chat-message parsing:

RegisterCommand('fd_help', function(source) if source == 0 then return end TriggerClientEvent('chat:addMessage', source, { args = { 'Help', 'Use the server rules page for current support instructions.' } }) end, false)

For a restricted command, set the restricted argument and configure a narrow ACE grant. Never treat hiding a chat suggestion as permission revocation. For message transformation/routing, inspect the chat message-hook export rather than exposing another client-controlled transport.

Source: pinned stock chat server . Related: chat:addMessage, stock resource directory.