Skip to content

vehicleSirenChanged

Tells your gamemode that a vehicle’s siren changed: switched by the driver, by an NPC, or by your gamemode. It is also sent when a vehicle with a siren appears and when it goes. vehicles.getSirenState already returns the new state.

server.on("vehicleSirenChanged", ({ vehicleId, fromActive, toActive, hasAddedSiren, reason, observedAtSessionMs }) => void)
Name Type Description
vehicleId number The vehicle.
fromActive boolean or null The siren before; null when the vehicle just appeared.
toActive boolean or null The siren now; null when the vehicle is gone.
hasAddedSiren boolean true when your gamemode gave the vehicle its siren with vehicles.setHasSiren.
reason "created" | "native" | "request" | "script" | "removed" The vehicle appeared, an NPC switched it, someone in the vehicle switched it, your gamemode switched it, or the vehicle is gone.
observedAtSessionMs number When, on the shared session clock.
gamemodes/my-mode.ts
import { server, vehicles } from "nativemp";
server.on("vehicleSirenChanged", ({ vehicleId, reason }) => {
const current = vehicles.getSirenState(vehicleId);
server.log(`Vehicle ${vehicleId}: ${current?.active ?? "gone"} (${reason})`);
});