EventMap
Defined in: server/api.d.ts:2704
Native events dispatched through Events.on. Each property is the exact callback argument tuple for that event.
Properties
Section titled “Properties”actionPointHit
Section titled “actionPointHit”actionPointHit: [
ActionPoint,Player]
Defined in: server/api.d.ts:2873
Dispatched when a player activates a replicated action point.
consoleCommand
Section titled “consoleCommand”consoleCommand: [
string,string[]]
Defined in: server/api.d.ts:2718
Dispatched after the server console parses a command line that is not handled by a built-in command.
doorInteract
Section titled “doorInteract”doorInteract: [
Player,string,boolean,boolean,number]
Defined in: server/api.d.ts:2853
Dispatched after a player opens, closes, kicks, locks or lockpicks a world door, with the door’s new state. doorId is the id the Door functions take; virtualWorld is the world whose door state changed. Never dispatched for a door whose interaction is disabled.
entityStateChange
Section titled “entityStateChange”entityStateChange: [
Entity,string,any,any]
Defined in: server/api.d.ts:2958
Dispatched when one key of an entity’s state changes: on the server when a script writes it, on a client when the write arrives. value is undefined when the key was removed and previous is undefined when it held nothing before, so a stored null stays distinguishable from an absent key. The entity is whatever the game’s WrapScriptEntity answers, and the base Entity handle by default.
jukeboxUse
Section titled “jukeboxUse”jukeboxUse: [
Player,number]
Defined in: server/api.d.ts:2868
Dispatched when a player uses a synchronized jukebox.
liftArrive
Section titled “liftArrive”liftArrive: [
string,number,number]
Defined in: server/api.d.ts:2863
Dispatched when a lift reaches the floor a player or Lift.setFloor sent it to. Timed on the server with the game’s own lift motion, so it lands within a fraction of a second of the cab stopping on players’ screens.
liftCall
Section titled “liftCall”liftCall: [
Player,string,number,number]
Defined in: server/api.d.ts:2858
Dispatched when a player presses a lift button, before the lift sets off for the floor they asked for. Return false from a handler to keep the lift where it is, for a locked floor or a keycard. liftId is the id the Lift functions take; virtualWorld is the world whose lift would move. A press while the lift travels elsewhere is dispatched at once too; if allowed, the lift goes there as soon as its current move ends. Never dispatched for a lift whose buttons are disabled, one already at that floor, or one already on its way there.
markerHit
Section titled “markerHit”Defined in: server/api.d.ts:2878
Dispatched when a player enters a marker’s trigger radius.
markerLeave
Section titled “markerLeave”Defined in: server/api.d.ts:2893
Dispatched when a player leaves a marker’s trigger radius.
npcDeath
Section titled “npcDeath”npcDeath: [
Npc,Player|null,NpcDeathInfo]
Defined in: server/api.d.ts:2783
Dispatched when a server-driven NPC dies, whether from a player’s hit or from npc.kill().
playerAmmoChange
Section titled “playerAmmoChange”playerAmmoChange: [
Player,number,number,number]
Defined in: server/api.d.ts:2763
Dispatched when the reserve or loaded ammunition of a carried weapon changes. Reported at most once per client frame, so a burst of fire arrives as one change.
playerChat
Section titled “playerChat”playerChat: [
Player,string]
Defined in: server/api.d.ts:2798
Dispatched when a player submits a chat message.
playerCommand
Section titled “playerCommand”playerCommand: [
Player,string,string[]]
Defined in: server/api.d.ts:2803
Dispatched when a player’s chat input is parsed as a command.
playerConnect
Section titled “playerConnect”playerConnect: [
Player]
Defined in: server/api.d.ts:2723
Dispatched after an M2O player is connected and its script handle can be resolved.
playerConnecting
Section titled “playerConnecting”playerConnecting: [
PendingConnection]
Defined in: server/api.d.ts:2963
Dispatched when a player asks to join, before the connection exists: they hold no player slot, are not counted as online, and are sent nothing – no resource list, no download, no body. The request waits until every handler has returned and every Promise a handler returned has settled, then it is let in if a player slot is free (otherwise it is refused as full). connection.reject() turns it away instead, and so does a handler that throws or rejects, or handlers that have not settled within the server’s admission timeout (30 seconds by default, restarted by every connection.update()). With no handler at all, every request is let in at once.
playerDamage
Section titled “playerDamage”playerDamage: [
Player,PlayerDamageInfo]
Defined in: server/api.d.ts:2788
Dispatched when the server relays a bullet hit the shooter resolved against a player. Fires before the victim applies it, so the resulting health arrives with that player’s next sync.
playerDeath
Section titled “playerDeath”playerDeath: [
Player,Player|null,PlayerDeathInfo]
Defined in: server/api.d.ts:2778
Dispatched after the server receives and resolves a player’s death report.
playerDialNumber
Section titled “playerDialNumber”playerDialNumber: [
Player,number,string,number]
Defined in: server/api.d.ts:2848
Dispatched after a player dials a registered phone-book number.
playerDisconnect
Section titled “playerDisconnect”playerDisconnect: [
Player]
Defined in: server/api.d.ts:2728
Dispatched when an M2O player disconnects.
playerPinupCollected
Section titled “playerPinupCollected”playerPinupCollected: [
Player,number,number]
Defined in: server/api.d.ts:2843
Dispatched when a player takes a pinup collectible — the Playboy magazines and the wanted posters, told apart by galleryId, where 1 is the wanted-poster gallery. The collectible is already recorded against the player and hidden on their client; any reward is up to the gamemode. Collected sets are per player and live only for the session, so persist them yourself and restore them with setPinupCollected.
playerShopBuy
Section titled “playerShopBuy”playerShopBuy: [
Player,string,number,number,number,boolean,string]
Defined in: server/api.d.ts:2838
Dispatched after a player buys an item from a native shop; price is expressed in currency units.
playerShopClose
Section titled “playerShopClose”playerShopClose: [
Player,string,number,string]
Defined in: server/api.d.ts:2833
Dispatched when a player closes a native shop.
playerShopEnter
Section titled “playerShopEnter”playerShopEnter: [
Player,string,string,boolean,string]
Defined in: server/api.d.ts:2823
Dispatched when a player triggers a city shop, whether or not the native menu came up. nativeOpened is false when a client shopOpen handler suppressed the menu or the game refused the open; source is "walkIn" or "script".
playerShopOpen
Section titled “playerShopOpen”playerShopOpen: [
Player,string,string]
Defined in: server/api.d.ts:2828
Dispatched when a player opens a native shop. shopName is the friendly shopmenu2 configuration name, which is what the client’s Shop.open and this side’s Shop.setItem take; shopPath is the internal shop script path.
playerSpawn
Section titled “playerSpawn”playerSpawn: [
Player]
Defined in: server/api.d.ts:2733
Dispatched after an M2O player spawns or respawns.
playerSubmerged
Section titled “playerSubmerged”Defined in: server/api.d.ts:2793
Dispatched when a player goes underwater and the game’s drowning sequence starts (it resurfaces them on the nearest shore). vehicle is the one they went under in, or null on foot.
playerVoiceStart
Section titled “playerVoiceStart”playerVoiceStart: [
Player]
Defined in: server/api.d.ts:2768
Dispatched when a player starts speaking on voice chat. Tracks speech rather than the push-to-talk key – silence never reaches the server – and fires whether or not anyone is in earshot.
playerVoiceStop
Section titled “playerVoiceStop”playerVoiceStop: [
Player]
Defined in: server/api.d.ts:2773
Dispatched shortly after a player’s last voice frame reaches the server. A disconnect ends talking without this event, since the player is already gone; clean up on playerDisconnect too.
playerWaypointCleared
Section titled “playerWaypointCleared”playerWaypointCleared: [
Player,number,number]
Defined in: server/api.d.ts:2818
Dispatched when a player clears the active GPS waypoint.
playerWaypointReached
Section titled “playerWaypointReached”playerWaypointReached: [
Player,number,number]
Defined in: server/api.d.ts:2813
Dispatched when a player reaches the active GPS waypoint.
playerWaypointSet
Section titled “playerWaypointSet”playerWaypointSet: [
Player,number,number]
Defined in: server/api.d.ts:2808
Dispatched when a player places a GPS waypoint.
playerWeaponAdd
Section titled “playerWeaponAdd”playerWeaponAdd: [
Player,number,number,number]
Defined in: server/api.d.ts:2753
Dispatched when a weapon enters a player’s inventory, by any route: giveWeapon, a pickup, a shop, or a client the server never told to add it.
playerWeaponFire
Section titled “playerWeaponFire”Defined in: server/api.d.ts:2743
Dispatched when the server receives a weapon-fire report from a player.
playerWeaponRemove
Section titled “playerWeaponRemove”playerWeaponRemove: [
Player,number]
Defined in: server/api.d.ts:2758
Dispatched when a weapon leaves a player’s inventory: removeWeapon, a drop, a thrown weapon used up, or a respawn reset.
playerWeaponSwitch
Section titled “playerWeaponSwitch”playerWeaponSwitch: [
Player,number,number]
Defined in: server/api.d.ts:2738
Dispatched after the server receives the player’s authoritative weapon-switch update.
playerWeaponThrow
Section titled “playerWeaponThrow”Defined in: server/api.d.ts:2748
Dispatched when a player releases a grenade or Molotov.
resourceStart
Section titled “resourceStart”resourceStart: [
string]
Defined in: server/api.d.ts:2708
Dispatched after a resource entry point has run and immediately before the resource becomes running.
resourceStop
Section titled “resourceStop”resourceStop: [
string]
Defined in: server/api.d.ts:2713
Dispatched while a resource is stopping, before its stop callback, timers, exports, and event handlers are cleaned up.
vehicleDestroy
Section titled “vehicleDestroy”vehicleDestroy: [
Vehicle]
Defined in: server/api.d.ts:2903
Dispatched immediately before or while a replicated vehicle is destroyed.
vehicleExplode
Section titled “vehicleExplode”Defined in: server/api.d.ts:2908
Dispatched when a replicated vehicle explodes.
vehicleLightBroken
Section titled “vehicleLightBroken”vehicleLightBroken: [
Vehicle,number]
Defined in: server/api.d.ts:2918
Dispatched when one of a vehicle’s headlights is smashed by body deformation.
vehiclePartDropped
Section titled “vehiclePartDropped”vehiclePartDropped: [
Vehicle,number,number]
Defined in: server/api.d.ts:2913
Dispatched when a vehicle deform part is torn off its body. partType is a VehiclePartType value.
vehiclePlayerEntered
Section titled “vehiclePlayerEntered”Defined in: server/api.d.ts:2943
Dispatched after a player has entered a vehicle.
vehiclePlayerEntering
Section titled “vehiclePlayerEntering”Defined in: server/api.d.ts:2938
Dispatched when a player begins entering a vehicle seat.
vehiclePlayerExited
Section titled “vehiclePlayerExited”Defined in: server/api.d.ts:2953
Dispatched after a player has exited a vehicle.
vehiclePlayerExiting
Section titled “vehiclePlayerExiting”Defined in: server/api.d.ts:2948
Dispatched when a player begins exiting a vehicle.
vehicleRadioChange
Section titled “vehicleRadioChange”Defined in: server/api.d.ts:2933
Dispatched after a vehicle driver changes its radio station.
vehicleSpawn
Section titled “vehicleSpawn”vehicleSpawn: [
Vehicle]
Defined in: server/api.d.ts:2898
Dispatched immediately after a replicated vehicle is created.
vehicleSubmerged
Section titled “vehicleSubmerged”vehicleSubmerged: [
Vehicle]
Defined in: server/api.d.ts:2923
Dispatched when a replicated vehicle goes underwater.
vehicleSurfaced
Section titled “vehicleSurfaced”vehicleSurfaced: [
Vehicle]
Defined in: server/api.d.ts:2928
Dispatched when a previously submerged replicated vehicle leaves the water.
volumeHit
Section titled “volumeHit”Defined in: server/api.d.ts:2883
Dispatched when a player enters a volume. The crossing is detected by the game’s own physics sensor on that player’s client, not by polling, so it fires on body overlap rather than when the player’s origin crosses the boundary.
volumeLeave
Section titled “volumeLeave”Defined in: server/api.d.ts:2888
Dispatched when a player leaves a volume, including when the volume is disabled, moved away or destroyed. A player who disconnects leaves without this event, so clean up on playerDisconnect too.
