SixL server API / world-entities / CheckpointMp
Interface: CheckpointMp
A checkpoint: a ring a player can enter.
Remarks
Partial: the server keeps the checkpoint, streams it to the clients and raises playerEnterCheckpoint / playerExitCheckpoint (checked every ~100 ms: the player must be in the checkpoint's dimension, within radius (3D distance) and the checkpoint must be shown for that player). The game does not draw checkpoints yet. Unlike other entities, type is the checkpoint kind (a number).
Example
const cp = mp.checkpoints.new(1, new mp.Vector3(0, 0, 70), 3);
Extends
Properties
data
data: any
The shared variables as properties: entity.data.key reads, entity.data.key = value sets.
Remarks
A view over BaseEntityMp.getVariable / BaseEntityMp.setVariable: setting a key sends it to clients exactly like setVariable.
Example
player.data.cash = 100;
Inherited from
destination
destination: IVector3
The next checkpoint's position (the checkpoint points at it); null if none. A plain { x, y, z } object.
Example
checkpoint.destination = { x: 100, y: 0, z: 70 };
dimension
dimension: number
The dimension the entity lives in: players see and stream only entities of their own dimension.
Remarks
Dimension 0 is the default world. For players it is applied at once and the streaming is recomputed; for other entities it is picked up on the next tick. For PlayerMp.isStreamed dimension 0 counts as global; for vehicles, peds and objects (isStreamed) the dimensions must be equal.
Example
player.dimension = 5;
Inherited from
direction
direction: IVector3
The direction the checkpoint points. A plain { x, y, z } object.
Example
checkpoint.direction = { x: 0, y: 1, z: 0 };
id
readonlyid:number
The entity's id, unique within its pool (mp.players, mp.vehicles …).
Remarks
Ids are server-side and start at 0 or 1 per pool, so two entities of different kinds can share one. The client's remoteId is this same number.
Example
const vehicle = mp.vehicles.at(vehicleId);
Inherited from
position
position: Vector3
The entity's position in metres.
Remarks
Reading returns the script host's copy. Setting moves the entity: for players, vehicles, peds and objects the new position is sent to the server (for peds the new position does not reach the clients yet). A blip, marker, label or checkpoint streams the new position to the players.
Example
player.position = new mp.Vector3(0, 0, 70);
Inherited from
radius
radius: number
The radius, in metres; the enter and exit events use the 3D distance.
Example
checkpoint.radius = 5;
type
type: number
The checkpoint kind, as given at creation.
Remarks
Not the entity kind string that other entities have.
Example
const kind = checkpoint.type;
visible
visible: boolean
Whether the checkpoint is shown to players in general.
Remarks
showFor / hideFor override it for single players; a player who may not see it cannot enter it.
Example
checkpoint.visible = false;
Methods
destroy()
destroy(): void
Removes the entity.
Returns
void
Remarks
For vehicles, peds and objects the entity is gone from its pool the moment destroy() returns (exists is false at once) and entityDestroyed follows. Players cannot be destroyed: use kick().
Example
vehicle.destroy();
Inherited from
dist()
dist(position):number
The distance from the entity to a point or another entity.
Parameters
position
IVector3 | { position: IVector3; }
A point (anything with x, y, z, metres) or an entity (anything with position).
Returns
number
The 3D distance in metres.
Example
if (player.dist(shop.position) < 3) { }
Inherited from
distSquared()
distSquared(position):number
The squared distance (no square root: cheaper for comparisons).
Parameters
position
IVector3 | { position: IVector3; }
A point (anything with x, y, z, metres) or an entity (anything with position).
Returns
number
The squared 3D distance, metres squared.
Example
if (player.distSquared(point) < 25) { }
Inherited from
PositionedEntityMp.distSquared
getColor()
getColor(index?):number[]
Reads the colour.
Parameters
index?
number
Optional. 0..3 for red, green, blue, alpha.
Returns
number[]
One component, or the whole [r, g, b, a] without an index.
Example
const [r, g, b, a] = checkpoint.getColor();
getVariable()
getVariable<T>(name):T
Reads a shared variable (set by BaseEntityMp.setVariable).
Type Parameters
T
T = any
Parameters
name
string
The variable's key.
Returns
T
The value, or undefined when it was never set. Read from the script host's own copy: no round trip.
Example
const job = player.getVariable('job');
Inherited from
PositionedEntityMp.getVariable
hideFor()
hideFor(players):void
Hides the checkpoint from some players.
Parameters
players
A player, a player id, or an array of them.
Returns
void
Example
checkpoint.hideFor(player);
setColor()
setColor(red,green,blue,alpha?):void
Sets the colour.
Parameters
red
number
Red, 0..255.
green
number
Green, 0..255.
blue
number
Blue, 0..255.
alpha?
number
Alpha, 0..255 (default 255).
Returns
void
Example
checkpoint.setColor(255, 255, 0, 150);
setVariable()
setVariable(name,value):void
Sets a shared variable on the entity.
Parameters
name
string
The variable's key.
value
any
Any JSON-serialisable value.
Returns
void
Remarks
The script's own copy changes at once. Players, vehicles, peds and objects also send it to the clients that have the entity streamed in (with the size and rate limits of the server; a refused change is logged by the script host and the local copy stays). Colshapes and dummies keep it on the server only. Blips, markers, labels and checkpoints send it with their other data.
Example
vehicle.setVariable('fuel', 42);
Inherited from
PositionedEntityMp.setVariable
setVariables()
setVariables(values):void
Sets several shared variables at once; the same as calling BaseEntityMp.setVariable for each key.
Parameters
values
An object of key to value.
Returns
void
Example
player.setVariables({ job: 'taxi', level: 3 });
Inherited from
PositionedEntityMp.setVariables
showFor()
showFor(players):void
Shows the checkpoint to some players, even when visible is false.
Parameters
players
A player, a player id, or an array of them.
Returns
void
Example
checkpoint.showFor(player);