οΈ Events
Updated 4/28/2026
ποΈ Events
π₯οΈ Client-Side Events
SetChatVisible(visible)
Sets the chat UI visibility and focus.
SetChatVisible(true) -- Show chat
SetChatVisible(false) -- Hide chat
visible(boolean) β Show (true) or hide (false) the chat.- When visible:
- Initializes server commands.
- Sends locales and colors to the NUI UI.
chat:receiveServerSuggestions
RegisterNetEvent('chat:receiveServerSuggestions', function(serverSuggestions) end)
- Receives server-side command suggestions.
- Combines them with client-side commands automatically.
- Sends combined suggestions to NUI for autocomplete.
chat:addMessage
RegisterNetEvent('chat:addMessage', function(messageData) end)
- Displays a message in the chat.
- Supports two formats:
- String β Displays as a system message.
- Table β Supports
author,args, and optionaltemplate.
chat:displayMessage
RegisterNetEvent('chat:displayMessage', function(msgType, title, message, channelData) end)
- Displays a message in a specific chat channel.
- Parameters:
msgTypeβsystem,template, orchannel.titleβ Author or channel name.messageβ Message content.channelDataβ Channel configuration (prefix,color,avatar).
chat:clear & chat:clearAll
RegisterNetEvent('chat:clear')
RegisterNetEvent('chat:clearAll')
- Clears all chat messages from the UI.
NUI Callbacks
close
RegisterNUICallback('close', function(_, cb) end)
- Triggered when the NUI chat window is closed.
- Sets chat visibility to false.
sendMessage
RegisterNUICallback('sendMessage', function(data, cb) end)
- Triggered when a message is sent from the chat UI.
- Executes commands starting with
/. - Sends normal messages as OOC to the server.
π Server-Side Events
chat:sendOocMessage
RegisterServerEvent('chat:sendOocMessage')
AddEventHandler('chat:sendOocMessage', function(message) end)
- Sends an OOC message to all players.
- Uses playerβs real name instead of character name.
chat:init
RegisterServerEvent('chat:init')
AddEventHandler('chat:init', function() end)
- Initializes player commands when chat opens.
- Refreshes available commands for the client.
chat:addMessage
RegisterServerEvent('chat:addMessage')
AddEventHandler('chat:addMessage', function(message, author) end)
- Sends a system message to all clients.
authordefaults toConfig.Locales.system_prefix.
Player Connection Events
playerJoining
- Refreshes commands for joining players.
onServerResourceStart
- Refreshes commands for all players when resource starts.
π Server Commands Related to Chat
Channel Commands
- Automatically registered for each channel in
Config.Channels(except/ooc). - Sends messages to the appropriate chat channel using
chat:displayMessage.
/announcement
- Admin-only command to send a system-wide message.
- Usage:
/announcement [message]
/clear
- Admin-only command to clear the chat for all players.