Skip to content

IEver3st/es_chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

es_chat - Command-First Chat System

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.

Dependencies

None. es_chat is fully standalone.

Installation

  1. Place es_chat in your resources directory.
  2. Add ensure es_chat to your server.cfg.
  3. Configure settings in config.lua.

Commands

Command Description
/togglechat Hide/show the entire chat UI
/clear Clear your chat history
/help Show help text

Keybinds

Key Action
T Open chat
Enter Send message
Escape Close chat
Tab Autocomplete suggestion
Arrow Up/Down Browse suggestions or input history

Client Exports

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.

Server Exports

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.

Message Format

-- 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.

Event Compatibility

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

Configuration

All settings are in config.lua.

Chat Behavior

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
}

Position

Config.Position = {
    Side = 'left',    -- 'left' or 'right'
    OffsetX = 20,     -- Horizontal offset (px)
    OffsetY = 20,     -- Vertical offset (px)
}

Debug

Config.Debug = {
    Enabled = false,  -- Enable debug logging
}

Features

  • 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 (^0 through ^9)
  • Auto-close after 60 seconds of inactivity
  • Drop-in replacement for default FiveM chat (compatible events)

About

Just a Skin for Fivem chat in my Library Style for Visual Consistency.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors