Events
Register a handler with mp.events.add(name, handler) on the server or in a client script. A handler that throws is reported in the log and the other handlers still run. SixL events cannot be cancelled (RAGE MP's this.cancel does nothing here).
mp.events.add('playerReady', (player) => player.outputChatBox('Welcome!'));
Several events have the same name on the server and on the client but different arguments. Each table below says where the event is raised.
Server events
Raised on the server; the handler runs in a server package.
| Event | When it fires | Arguments, in order |
|---|---|---|
packagesLoaded | Every server package finished loading. | none |
incomingConnection | A connection arrived and is being set up. The handler cannot refuse it. | ip (text): the client's address; serial (text): the hardware serial (64 hex characters) or an empty text; login (text): the lobby account name the player proved, or an empty text for a guest |
playerJoin | A player connected, before the client is ready. | player |
playerReady | The player's client is ready (after the welcome and the load-in scene). player.position is where the player really is (the server waits a moment for the first position from the player's game, so placing something near the player works). A teleport or player.spawn() is safe here. playerSpawn follows at once. | player |
playerSpawn | Right after playerReady for the first spawn, and again after every player.spawn(). | player |
playerQuit | A player left. The player is already removed from mp.players but still readable. Raised before entityDestroyed. | player; exitType (text): 'disconnect', 'timeout' or 'kicked'; reason (text): the text shown when kicked or banned, otherwise empty |
playerChat | A player sent a chat line. | player; text (text) |
playerCommand | A player sent a command (/name ...) that no mp.events.addCommand handler is registered for. | player; command (text): the whole line without the slash, arguments included |
playerDamage | A player lost health or armour (once per loss; healing raises nothing). | player; healthLoss (number); armorLoss (number) |
playerDeath | A player died (once until their health is above 0 again). | player; reason (number): the weapon hash of the last hit report younger than 5 seconds, or 0; killer (player): who made that hit, or undefined |
playerWeaponChange | The weapon in the player's hand changed. | player; oldWeapon (number); newWeapon (number): GTA VI weapon hashes |
playerWeaponHit | A player's shot hit another player. A request: the script must check it and apply the damage itself. | attacker (player); target (player); hit (object): damage, weapon, bodyPart, bone, point ({ x, y, z }) |
pedWeaponHit | A player's shot hit a server ped. The script applies the damage itself. | attacker (player); ped; hit (object): damage, weapon, and, with the current protocol, bone, bodyPart, point |
playerStartEnterVehicle | A player started getting into a vehicle (walking to the door, opening it). The seat is kept for them from now on. | player; vehicle (or null); seat (number, 0 = driver) |
playerEnterVehicle | A player sat in a vehicle. Not raised for an entry the player gave up. | player; vehicle (or null); seat (number, 0 = driver) |
playerStartExitVehicle | A player started getting out of a vehicle. They still have the seat. | player |
playerExitVehicle | A player left a vehicle. | player; vehicle (or null); seat (number): the seat they had |
playerStreamIn | A player came into another player's range. | player: who came into range; forPlayer: who now sees them |
playerStreamOut | A player left another player's range. | player; forPlayer |
playerEnterColshape | A player entered a colshape (checked about every 100 ms, same dimension). | player; colshape |
playerExitColshape | A player left a colshape (not raised for a player who left the server). | player; colshape |
playerEnterCheckpoint | A player entered a checkpoint (3D distance, same dimension, checkpoint shown to them, checked about every 100 ms). | player; checkpoint |
playerExitCheckpoint | A player left a checkpoint. | player; checkpoint |
playerReachWaypoint | A player reached the waypoint set on the map: the player's client saw it go away with the player within 50 m of it (asked once a second) and told the server. Raised while the player's client is connected and its runtime runs: the client asks about the waypoint once a second, whether or not a client script listens. | player |
vehicleDamage | A vehicle lost health (once per loss, from the driver's reported state). | vehicle; bodyHealthLoss (number); engineHealthLoss (number) |
vehicleDeath | A vehicle was destroyed (once per death). | vehicle |
vehicleSirenToggle | The siren of a vehicle was turned on or off (from the driver's reported state; partial, not yet confirmed in the game). | vehicle; state (true when on) |
trailerAttached | A trailer was hitched to a vehicle, or let go (from the driver's reported state; partial, not yet confirmed in the game). | vehicle; trailer (the trailer vehicle, null when let go) |
entityCreated | An entity was created: a player joined, or a vehicle, ped, object, blip, marker, label, checkpoint or colshape was made. | entity |
entityDestroyed | An entity was destroyed or left. | entity |
entityModelChange | A script changed an entity's model (not for the first value). | entity; oldModel (text or number) |
dummyEntityCreated | A dummy entity was created. | dummy |
dummyEntityDestroyed | A dummy entity was destroyed. | dummy |
serverShutdown | The server is shutting down. Handlers have about 0.2 seconds. | none |
Chat commands
mp.events.addCommand('name', (player, fullText, ...words) => {}) registers a command. The name is matched without regard to case and a leading slash is optional. fullText is everything after the command name; words are the same text split by spaces. When a handler exists for the command, only that handler runs and playerCommand is not raised.
The game client has a built-in chat (mp.gui.chat): the player presses T, types a line and presses Enter. A line that starts with / is a command: playerCommand, or the handler registered with addCommand. Any other line raises playerChat. At most 5 lines in 3 seconds are sent from the game client, and a line is cut to 256 characters. The server enforces its own limit for each player as well (by default 10 lines in 3 seconds, chat and commands together, and 256 characters; see chat in the server settings): lines over it never reach playerChat or playerCommand, so a modified client cannot flood your handlers. The server's player.outputChatBox lines appear in the built-in chat. A game mode that wants its own chat page marks a browser with markAsChat, and the chat goes to it.
Damage and death
Which events exist today, and who decides what.
| What happened | What your server script gets |
|---|---|
| A player shot another player | playerWeaponHit(attacker, target, hit): a request. Nothing is subtracted for you. |
| A player shot a server ped | pedWeaponHit(attacker, ped, hit): a request. The ped keeps its health until your script acts. pedDamage follows with the attacker (see below). |
| A server ped was hurt by anything: a shot, a vehicle, a fall, an explosion, another ped | pedDamage(ped, attacker, weapon, damage, bone, cause): one client's statement, a request like pedWeaponHit. attacker is a player, a ped or a vehicle that client could see, and undefined for the world or anything it could not see. |
| A player was hurt | playerHurt(player, attacker, weapon, damage, bone, cause) from the player's own client: who it says did it. The game has applied the damage already, but who did it is the client's word. |
A player lost health or armour, from any cause (a shot, a fall, a vehicle, an explosion, your own health change) | playerDamage(player, healthLoss, armorLoss), once per loss. It comes from the player's reported state: it has the amounts, playerHurt has the source. |
| A player's health reached 0 | playerDeath(player, reason, killer), once until the health is above 0 again. reason is the weapon of the last hit on the player and killer the player who made it (the driver, for a vehicle), when such a hit was reported in the last 5 seconds (playerWeaponHit or playerHurt); otherwise 0 and undefined. |
| A vehicle lost health or was destroyed | vehicleDamage and vehicleDeath, from the driver's reported state. |
cause is 1 for a shot, 2 for a vehicle and 0 for everything else; for a fall, an explosion or fire the weapon hash names the source. Melee blows are not told apart from other damage yet (cause is never 5 today), and explosions and falls are not told apart from each other by cause.
Who reports a hit, and how repeats are handled:
- The shooter's own client reports its shots (
playerWeaponHit,pedWeaponHit). A server ped has no owner, so every player who has it in range may report the same hit by a vehicle, a fall or an explosion; the server raisespedDamageonce per hit. Reports of the same victim, attacker, cause and weapon within 120 ms count as one hit, so a very fast burst from one non-player source can be merged into fewer events than there were hits. Shots of a player are never merged: they come from that player alone. - A hit on a player is reported by that player's own client, nobody else's. A player who is hit by a vehicle, a fall or an explosion produces
playerHurt, andplayerDeathcan name the driver as the killer. pedDamageandplayerHurtare ONE client's statement, not a fact: a modified client can send a damage of up to 1000 about any ped it has in range, name any player or ped it has in range as the attacker, or claim a hurt on itself. The server only drops what it can see is wrong (a ped or attacker the client has not got in range, damage above 1000, more than 30 reports per second from one player, a repeat within 120 ms), and cleans the rest (acauseoutside 0, 1, 2 and 5 becomes0; an unusable hit point is not passed on). Your script checks distance, rate of fire and the attacker, as it does forpedWeaponHit, before it applies anything.playerDeathtakes itskillerfrom the same statements: do not hand out kill rewards on it alone.- Damage on vehicles is not reported as hits yet: use
vehicleDamageandvehicleDeath.
Server peds can be damaged by default, as mp.peds in RAGE MP: make one invincible when you create it, or later with setInvincible. The game reports every hit on a server ped (pedDamage, pedWeaponHit) and does not apply the damage itself: your script decides what the hit does - apply it, ignore it, or kill the ped. A server ped has no health property; keep the ped's health in your own data (for example a Map keyed by ped.id), subtract the damage in your handler and call ped.destroy() when it reaches 0. Players are the other way round: the game applies the damage to them as it normally does, and playerHurt only tells you who did it.
Applying damage from a script:
const health = new Map(); // ped.id -> health, your own bookkeeping
mp.events.add('pedWeaponHit', (attacker, ped, hit) => {
const left = (health.get(ped.id) ?? 100) - hit.damage;
health.set(ped.id, left);
if (left <= 0) ped.destroy();
});
mp.events.add('playerWeaponHit', (attacker, target, hit) => {
// validate first: range, weapon, rate of fire, team rules ...
target.health -= hit.damage; // setting health sends it to the player; at 0 playerDeath follows
});
// A car, a fall or an explosion hurt a ped: a statement of one client, so validate it first
mp.events.add('pedDamage', (ped, attacker, weapon, damage) => {
const sane = damage > 0 && damage <= 100;
// an attacker must be near the ped; the world (undefined) is limited to one hit a second per ped
const near = !attacker || !attacker.position || distance(attacker.position, ped.position) < 100;
if (!sane || !near || tooFast(ped)) return;
const left = (health.get(ped.id) ?? 100) - damage;
health.set(ped.id, left);
if (left <= 0) ped.destroy();
});
// distance() and tooFast() are yours: a vector length and a per-ped rate check
For a player, set player.health and player.armour on the server. The new value goes to the player's client, and playerDamage and playerDeath follow from the reported state.
Events sent by clients and by your scripts
Any other event name is yours:
mp.events.callRemote('name', ...args)on the client raisesnameon the server; the handler gets(player, ...args). The arguments must be JSON-serialisable.mp.events.call('name', ...args)raises an event locally, on the side that calls it.player.call('name', ...args)on the server raisesnameon that player's client with(...args).mp.players.calldoes it for every player.
Names that start with sixl: are used by the platform; do not use them.
Client events
Raised on the player's computer; the handler runs in a client script.
| Event | When it fires | Arguments, in order |
|---|---|---|
playerReady | The local player is ready: the server welcomed the client and the load-in scene has finished. Once per session. Scripts are already loaded, so handlers added at load time are in place. A teleport is safe here. | none |
playerJoin | A player became known to this client: the first time they come into range, once until they quit. Not raised for the local player. | player |
playerQuit | A player the client had in range left the server. Raised before entityStreamOut. | player |
playerSpawn | The local player is alive again after a death. Not raised for the first spawn of the session. | player: the local player |
playerDeath | The local player died (once per death). | player: the local player; reason: the weapon of the last hit on the player in the 5 seconds before (see incomingDamage), else 0; killer: the player who made that hit, else undefined (a hit by a ped, a vehicle or the world names no killer) |
playerEnterVehicle | The local player sat in a vehicle of the server (again after playerLeaveVehicle when moving to another seat). | vehicle; seat (number, 0 = driver) |
playerLeaveVehicle | The local player left a seat of a vehicle of the server (also when moving to another seat). | vehicle; seat (number) |
entityStreamIn | An entity came into the client's range: a player, ped, vehicle, object, blip, marker, label or checkpoint. | entity |
entityStreamOut | An entity is leaving the range; it is still readable in the handler. | entity |
playerWeaponShot | The local player fired a weapon (one event per shot). | targetPosition ({ x, y, z } in metres); targetEntity: always undefined |
outgoingDamage | The local player's shot hit a player or ped of the server and the hit went to the server. Returning true does not cancel it. | sourceEntity; targetEntity; targetPlayer (undefined for a ped); weapon (number); boneIndex (number: a hash of the bone's name, 0 if unknown); damage (number) |
incomingDamage | The local player was hurt: by a shot, a vehicle, a fall, an explosion or anything else. The damage has already landed in the game: returning true does not cancel it. | sourceEntity (the player, ped or vehicle that did it; undefined for the world or an entity this client does not hold); sourcePlayer (undefined unless a player did it); targetEntity (the local player); weapon (number; for a fall, an explosion or fire it names that source); boneIndex (number: a hash of the bone's name, 0 if unknown); damage (number) |
render | Every frame of the game. Keep the work small. | none |
playerEnterColshape | The local player came into a colshape this client made (mp.colshapes), in its dimension. Checked every frame; once per crossing. | shape |
playerExitColshape | The local player left a colshape this client made. A destroyed colshape raises none. | shape |
playerEnterCheckpoint | The local player came within a checkpoint's radius (the server's checkpoints and the client's own), in its dimension. Checked every frame. | checkpoint |
playerExitCheckpoint | The local player left a checkpoint's radius. A destroyed checkpoint raises none. | checkpoint |
playerCreateWaypoint | The player set a waypoint on the map. Up to a second late: the game is asked once a second. | position (Vector3) |
playerReachWaypoint | The waypoint went away with the player within 50 m of it. | player: the local player |
dummyEntityCreated | A dummy entity of the server's scripts is known to this client (made by the server, or there when the client joined; again after the client's scripts restart). Its variables are readable in the handler. | dummyType (number); dummy |
dummyEntityDestroyed | A dummy entity of the server's scripts was destroyed, or the client left the server. | dummyType (number); dummy |
browserCreated | A browser was created with mp.browsers.new. | browser |
browserDomReady | A browser's page finished loading its document. | browser |
browserLoadingFailed | A browser's page failed to load. | browser; url (text); reason (text) |
uncaughtException | A script threw an error that nothing caught. The error is logged and the runtime keeps running. | error |
unhandledRejection | A promise was rejected and nothing handled it. The reason is logged and the runtime keeps running. | promise; error (the rejection reason) |
Differences from RAGE MP
incomingConnectionhas three arguments,(ip, serial, login). GTA VI has no Social Club, so there is norgscName,rgscIdorgameType. Theserialis computed by the client: a modified client can forge it, and it is the same on every SixL server for one computer, so use it for bans and for recognising a returning player, not as proof of identity.vehicleHornToggleis not raised yet: GTA VI has no horn query SixL can use.trailerAttachednames only a trailer that is a server vehicle (a trailer the game made by itself raises nothing) and is also raised withtrailernullwhen the trailer is let go. Both it andvehicleSirenToggleneed a client and game version that report them; an older one raises nothing.- Damage: the game does not apply damage to server peds for you the way RAGE MP does.
playerWeaponHitandpedWeaponHitare SixL events and are requests, not facts; your script validates the hit and applies it.pedDamageandplayerHurtare SixL events too: they tell the source of damage that happened. The client eventsmeleeActionDamageandexplosionare not raised yet. See Damage and death for what is reported and what is not. playerWeaponChangepasses GTA VI's weapon hashes, not GTA V's.playerStartEnterVehicleandplayerStartExitVehiclecannot be cancelled. With an older game client they come together withplayerEnterVehicleandplayerExitVehicle.- On the client,
entityStreamInandentityStreamOutare also raised for blips, markers, labels and checkpoints, which RAGE MP does not stream.playerJoin,playerQuitandplayerSpawncover only what the client sees (see the table). - On the client,
browserLoadingFailedhas the arguments(browser, url, reason),renderpasses no list of nametags, andplayerEnterVehicleandplayerLeaveVehiclereport only vehicles made by the server. callRemoteUnreliableis delivered reliably.dummyEntityCreatedanddummyEntityDestroyedare raised on the server and on every client, as the server's dummies reach the clients.- The client's colshapes and checkpoint events are decided by the client from the local player's position each frame; the server's colshapes are not sent to clients (as in RAGE MP).
playerCreateWaypointcan come up to a second late. - Not raised on the client yet:
click,entityControllerChange,explosion,meleeActionDamage,projectile,pauseMenuItemChange,pauseMenuItemSelect,playerResurrect,playerStartTalking,playerStopTalking. SixL has noconsoleCommand(no in-game console to type in),playerRuleTriggeredorreplayEditorRequest.