A smart command-first chat system for FiveM built in the es_lib design language. All input is treated as commands by default, with optional smart detection that distinguishes between commands and plain text.
None. es_chat is fully standalone.
- Place
es_chatin your resources directory. - Add
ensure es_chatto yourserver.cfg. - Configure settings in
config.lua.
| Command | Description |
|---|---|
/togglechat |
Hide/show the entire chat UI |
/clear |
Clear your chat history |
/help |
Show help text |
| Key | Action |
|---|---|
T |
Open chat |
Enter |
Send message |
Escape |
Close chat |
Tab |
Autocomplete suggestion |
Arrow Up/Down |
Browse suggestions or input history |
| Export | Parameters | Returns | Description |
|---|---|---|---|
addMessage(data) |
table |
— | Add a chat message. |
registerSuggestion(name, help, params) |
string, string?, table? |
— | Register an autocomplete suggestion. |
open() |
— | — | Programmatically open the chat. |
close() |
— | — | Programmatically close the chat. |
isOpen() |
— | boolean |
Whether the chat input is currently open. |
| Export | Parameters | Returns | Description |
|---|---|---|---|
addMessage(target, data) |
number, table |
— | Send a message to a player. Use -1 for all players. |
clearChat(target) |
number |
— | Clear chat for a player. Use -1 for all players. |
registerSuggestion(name, help, params) |
string, string?, table? |
— | Register a suggestion for all players. |
-- Simple message
exports.es_chat:addMessage({ args = { "Hello world" } })
-- Message with author
exports.es_chat:addMessage({ args = { "PlayerName", "Hello world" } })
-- Colored message
exports.es_chat:addMessage({ color = {255, 0, 0}, args = { "Error", "Something went wrong" } })
-- Typed message (affects left border color)
exports.es_chat:addMessage({ template = "Server restarting...", type = "system" })Message types: system (yellow), error (red), success (green), or default (white).
FiveM color codes (^0 through ^9) are supported in message text.
es_chat is a drop-in replacement for the default FiveM chat. All standard events are supported:
| Event | Description |
|---|---|
chat:addMessage |
Standard cfx chat message event |
chatMessage |
Legacy chat message event (author, color, text) |
es_chat:addMessage |
Native es_chat event |
es_chat:clear |
Clear chat |
chat:addSuggestion |
Register a single suggestion |
chat:addSuggestions |
Register multiple suggestions |
chat:removeSuggestion |
Remove a suggestion |
All settings are in config.lua.
Config.Chat = {
ForceCommand = true, -- true: all input is treated as commands
-- false: smart detection (commands vs plain text)
MaxMessages = 50, -- Max visible messages (10-200)
FadeTimeout = 8000, -- Time before messages fade out (ms, 1000-60000)
OpenKey = 'INPUT_MP_TEXT_CHAT_ALL', -- Key to open chat (T)
EnableSuggestions = true, -- Enable autocomplete popup
MaxSuggestions = 5, -- Max autocomplete results shown
}Config.Position = {
Side = 'left', -- 'left' or 'right'
OffsetX = 20, -- Horizontal offset (px)
OffsetY = 20, -- Vertical offset (px)
}Config.Debug = {
Enabled = false, -- Enable debug logging
}- Command-first design with optional smart detection mode
- Autocomplete with Tab completion and arrow key navigation
- Input history (last 50 entries) via arrow keys
- Resolution-adaptive scaling based on screen height
- Server-side sanitization (strips HTML tags, 300 character limit)
- FiveM color code support (
^0through^9) - Auto-close after 60 seconds of inactivity
- Drop-in replacement for default FiveM chat (compatible events)