Skip to main content

Server-side NodeJS Events

Register with mp.events.add(name, handler), exactly as in RAGE:MP.

mp.events.add('playerJoin', (player) => {
mp.players.broadcast(`${player.name} joined.`);
});

mp.events.add('playerQuit', (player, exitType, reason) => {
savePlayer(player);
});

31 of the 32 documented events are live. The one exception is listed at the bottom.

Checkpoint​

playerEnterCheckpoint · playerExitCheckpoint

Colshape​

playerEnterColshape · playerExitColshape

Colshapes are server-authoritative — the server owns the shape and does the enter/leave detection, so a client cannot spoof entry.

Entity​

entityCreated · entityDestroyed · entityModelChange

Player​

playerChat · playerCommand · playerDamage · playerDeath · playerJoin · playerQuit · playerReady · playerSpawn · playerWeaponChange

playerJoin fires when the player is fully in the world; playerReady follows once the client's own scripts are running and its handlers are registered.

playerCommand currently fires only for commands that are not in the JS command registry (mp.events.addCommand). A command with a registered handler runs that handler instead.

Server​

serverShutdown · incomingConnection · packagesLoaded

packagesLoaded fires once, after every package's main script has run — the right place for "everything is registered, now build state" work.

serverShutdown fires before resources stop, so you still have a live script context to flush state in.

incomingConnection is informational on the JS side. The connection verdict has to be returned synchronously before the server accepts the peer, while the JS queue is drained later on the script thread — so a JS handler cannot refuse a connection. Use it for logging and bookkeeping. The C# IncomingConnection handler can refuse.

Streaming​

playerStreamIn · playerStreamOut

mp.events.add('playerStreamIn', (player, forPlayer) => { });

Raised from the entity streamer's own enter/leave transitions, so they line up exactly with what each client was actually sent.

Vehicle​

playerStartEnterVehicle · playerEnterVehicle · playerExitVehicle · trailerAttached · vehicleDamage · vehicleDeath · vehicleHornToggle · vehicleSirenToggle

Waypoint​

playerCreateWaypoint · playerReachWaypoint

playerCreateWaypoint carries the waypoint position.

Not implemented​

EventWhy
playerStartExitVehicleneeds a client-side "began exiting" edge. The client detects the completed exit, but has no reliable started-exiting signal — firing it on a guessed task index would raise it at the wrong moment, which is worse than not raising it

A note on event names​

RAGE:MP's server-side NodeJS names differ from the internal names our net layer and C# bridge use (playerLeave internally is playerQuit here, entityDeleted is entityDestroyed, and so on). The JS host translates on the way in, so you always write RAGE:MP's name. If you are reading server logs and see the internal spelling, that is the same event.