N.checkpoint β ServerCheckpoint Creator
`N.checkpoint` is a powerful, structured system for creating and managing checkpoints on the server. Each checkpoint is registered inside `N.checkpoint.list`, allowing you to track, remove, or modif
It supports:
β Custom radius, color, and dimension
β Enter/Exit callbacks
β One-time triggers (
once)β Player cooldowns
β Internal storage for all active checkpoints
πΉ Basic Example
const jobStart = N.checkpoint.create({
id: "job_start",
pos: { x: 215.5, y: -810.2, z: 30.7 },
color: [0, 255, 0, 150],
radius: 2.0,
dimension: 0,
once: false,
cooldown: 5000, // 5s per-player cooldown
onEnter: (player) => {
player.notify("π¦Ί Press E to start your job!");
},
onExit: (player) => {
player.notify("π You left the job zone.");
}
});β NurJS will:
Create a checkpoint with the specified position, color, and radius
Save it inside
N.checkpoint.listAutomatically handle entry/exit events for all players
βοΈ Parameters
id
string
auto-generated
Unique checkpoint ID (cp_...).
pos
object
β
Coordinates {x, y, z} of the checkpoint.
radius
number
1.5
Detection radius.
color
array
[255,255,255,150]
RGBA color.
dimension
number
0
Dimension the checkpoint exists in.
onEnter
function(player)
β
Called when a player enters the checkpoint.
onExit
function(player)
β
Called when a player leaves the checkpoint.
once
boolean
false
If true, runs onEnter only once per player.
cooldown
number
0
Minimum time (ms) between re-triggering onEnter.
π§ How It Works
When you call N.checkpoint.create(...), NurJS:
Validates input data (
posrequired).Creates an internal checkpoint using
mp.checkpoints.new().Stores all details (callbacks, cooldowns, player list) inside
N.checkpoint.list.Automatically handles enter/exit logic via global events (
playerEnterCheckpoint,playerExitCheckpoint).
You can later access or manipulate them:
π§© Example: Mission Objective
After one entry, this checkpoint will no longer trigger again for that player.
π§± Internal Structure
Each registered checkpoint in N.checkpoint.list looks like this:
This makes it easy to:
Access the checkpoint by reference
Track players currently inside
Extend functionality (e.g., auto-remove or time-based despawn)
π Notes
All checkpoints are stored in memory and reset after a server restart.
Use
once: truefor single-use checkpoints (missions, triggers).You can extend
N.checkpointwith custom methods like.remove()or.clearAll()easily.Optionally log creation with
N.notify()for debugging:
N.checkpoint provides a fully managed system for safe, event-driven checkpoint creation.
Itβs ideal for missions, job zones, and event areas β keeping all logic centralized and reusable.
Last updated