vehicleStateRemoved
Tells your gamemode when a vehicle leaves the shared world. The SDK removes that vehicle’s state and siren snapshots before your handler runs. Moving out of scope or handing simulation to another player does not remove the vehicle.
Signature
Section titled “Signature”server.on("vehicleStateRemoved", ({ vehicleId, observedAtSessionMs }) => void)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
vehicleId |
number |
The vehicle’s network ID. |
observedAtSessionMs |
number |
When the vehicle left on the shared session clock. |
Example
Section titled “Example”import { server, vehicles } from "nativemp";
server.on("vehicleStateRemoved", ({ vehicleId }) => { server.log(`Vehicle ${vehicleId} removed; snapshot: ${vehicles.getState(vehicleId) ?? "gone"}`);});Related
Section titled “Related”vehicles.getState: read the current snapshotVehicleStateRemovedPayload: event payloadvehicleStateAvailable: a snapshot became available