ns-chat
Voice-RP chat by NullSect · Standalone · Qbox / QBCore / ESX ready
A small, GTA World style chat for voice-RP servers. There is no IC text chat: the chat is only for me, do, a persistent status and helper channels. Plain text that is not a command is silently ignored.
Features
me/doin the chat and above the character,statuson the character's chest while active- Typing indicator: a "..." bubble above the head while a player types
- Every command works with and without
/(me ...=/me ...), other resources' commands too (e dance) - Channels:
ooc, local OOCb,pm/r,twt,ad,911(only emergency jobs receive it) - Two themes: Classic (
[21:42] [42] Mehmet [ME]: text) and Modern (bubbles) - Player settings panel: theme, size, position (drag & drop), background, time, fade, overhead texts
- Autocomplete, input history, timestamps, local mute, font size
- Character names from Qbox / QBCore / ESX, statuses follow the character (multichar safe)
- Server-authoritative: distance, cooldowns, flood protection, text sanitising, XSS safe NUI
- Default chat compatible (
chat:addMessage,exports.chat:*, suggestions, templates withchat:addTemplate+templateId),provide 'chat' - No database, no idle loops, English & Turkish
Quick start
See INSTALLATION.md and CONFIGURATION.md.
# ensure chat <- remove the default chat
ensure ns-chat # put it where "ensure chat" was, before your other resources
Requires OneSync.
Commands
| Command | Description |
|---|---|
me [action] | Action, nearby (chat + above the head) |
do [description] | Environment description, nearby (chat + above the head) |
status [text] | Persistent character status, overwrites the previous one |
status | Re-share the active status with nearby players |
status clear | Remove the active status |
ooc [message] | Global OOC |
b [message] | Local OOC |
pm [id] [message] / r [message] | Private message / reply |
twt [message] | Twitter channel |
ad [message] | Advertisement (cooldown) |
911 [message] | Emergency call to Config.EmergencyJobs |
clear | Clear the chat history |
mute [id] / unmute [id] | Local mute (mute alone lists) |
togglechat | Hide / show the chat |
fontsize [10-24] | Font size |
Keys: Enter (and T by default) open, Enter send, ESC close, Tab complete, ↑/↓ suggestions or history, PageUp/PageDown scroll. Keys can be rebound in the FiveM key bindings.
Status
- Stored server-side (no database). Nearby players see it on the character's chest; it appears for players who walk into range and disappears when they leave.
- A
[STATUS]line is posted in the chat and fades likeme/do. StatusOnDeath,StatusOnDisconnect,StatusOnRestartdecide what happens on death, logout / disconnect and resource restart. With a framework a kept status only returns to the same character.
Integration
Server exports:
exports['ns-chat']:SetStatus(playerId, text)
exports['ns-chat']:ClearStatus(playerId)
exports['ns-chat']:GetStatus(playerId)
exports['ns-chat']:SendSystemMessage(playerId or -1, text)
Server hooks (listen with AddEventHandler, never RegisterNetEvent):
AddEventHandler('ns-chat:sv:onEmergencyCall', function(callerId, data)
-- data.message, data.name, data.coords (vector3) -> your dispatch / MDT
end)
AddEventHandler('ns-chat:sv:onStatusChanged', function(playerId, text) end) -- text nil = removed
Client: exports['ns-chat']:addMessage({ author = 'System', text = '...' }), clear(), isOpen().
Framework code lives in bridge/framework.lua (open file).
Security
- One server router for every command; the player is always resolved from
source. - Distance is checked with server-side coordinates and routing buckets.
- UTF-8 aware length limits; control, colour, bidi and zero-width characters are stripped.
- Per-command cooldowns and a per-player flood limit.
- The NUI renders all text as text (no HTML / XSS).
Open files
config.lua, shared/locale.lua, bridge/framework.lua