N.utils provides a set of simple but powerful helper methods
used across all NurJS systems — for positions, random values, money formatting, and more.
These utilities work both client and server side, depending on the context.
N.utils.distance(p1, p2)
Calculates the 3D distance between two positions or players.
const dist = N.utils.distance(player.position, { x: 440, y: -981, z: 30 });
if (dist < 3) mp.gui.chat.push("✅ You are close!");
mp.Player / Vector3 / {x,y,z}
mp.Player / Vector3 / {x,y,z}
✅ Automatically supports both player.position and plain {x, y, z} objects.
If something goes wrong, returns 999999 safely (no crash).
🎲 N.utils.random(min, max)
Returns a random integer between min and max (inclusive).\
const value = N.utils.random(1, 10);
mp.gui.chat.push(`🎲 Random number: ${value}`);
✅ Safe and integer-based — returns 0 if parameters are invalid.
N.utils.formatMoney(amount, suffix = "$")
Formats a number with spaces as thousand separators
and appends a currency suffix.
Output:
Parameter
Type
Default
Description
✅ Returns a clean readable string.
If amount is invalid, returns "0$".
📍 N.utils.vector(x, y, z)
Quickly creates a mp.Vector3 instance from coordinates or object.
✅ Automatically detects if you pass an object or individual coordinates.
Y coordinate (ignored if x is object)
Z coordinate (ignored if x is object)
N.utils.isNear(player, pos, radius = 3)
Checks if a player is within a given radius from a point.Checks if a player is within a given radius from a point.
Parameter
Type
Default
Description
✅ Returns true if inside area, false otherwise.
🧠 Internal Implementation
💡 Example — Zone Trigger
✅ Commonly used in:
N.utils provides core helper methods used everywhere in NurJS:
It’s the foundation layer for all advanced systems like zones, checkpoints, and key binds.
Last updated