N.chat() is a small but powerful helper that sends text messages to the in-game chat —
automatically detecting whether it’s running on the client, server, or debug/console.
It’s ideal for quickly sending debug info, test messages, or cross-environment logs.
🔹 Basic Syntax
N.chat("✅ Hello from NurJS!");
✅ NurJS will automatically:
Use mp.gui.chat.push() if running on the client
Use player.outputChatBox() if running on the server
Fallback to console.log() if neither environment is available (e.g., debug mode)
⚙️ Behavior by Environment
Environment
Output Method
Example
🖥️ Client
mp.gui.chat.push()
N.chat("Hello from client!")
🗄️ Server
player.outputChatBox()
N.chat("Hello from server!")(inside player context)
🧠 Debug / Console
console.log()
[Chat] Hello from NurJS!
🧩 Example (Client-Side)
mp.events.add("playerJoin",()=>{N.chat("👋 Welcome to the server!");});
✅ Output in chat:
🧩 Example (Server-Side)
Internally, this runs player.outputChatBox() automatically.
🧩 Example (Debug / Development)
When used outside of RAGE:MP (e.g. in a Node.js test or console):
Output in console:
🧠 How It Works
✅ Automatically detects the current environment
✅ No setup required — works anywhere
📘 Notes
Works with all color tags and formatting (!{r,g,b}Text style supported).
Doesn’t require specifying player manually if used inside a command or event callback.
Safe to call from any NurJS module — even inside async logic.
N.chat() is a universal cross-environment chat utility —
it instantly adapts to client, server, or debug environments to show your messages correctly.
Use it for debugging, logging, or sending quick in-game messages.