vehicleSirenChangeRequest
Asks your gamemode when a driver switches the siren on or off. A passenger cannot switch it, as in the game.
Renamed in 0.28 from vehicleSirenChange; see renamed names.
Signature
Section titled “Signature”server.on("vehicleSirenChangeRequest", ({ player, fromActive, toActive }) => boolean | void | Promise<boolean | void>)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerInVehicle |
The driver asking; vehicleId is the vehicle and seat is always 0. |
fromActive |
boolean |
The siren now. |
toActive |
boolean |
What they want. |
Returns
Section titled “Returns”false keeps the siren as it is. Anything else switches it. See how decisions work.
Example
Section titled “Example”Only on-duty police use sirens.
import { server } from "nativemp";
const onDuty = new Set<number>();server.on("vehicleSirenChangeRequest", ({ player }) => onDuty.has(player.id));Related
Section titled “Related”vehicleRadioStationChangeRequest: the radiovehicleSirenChanged: the siren changed, whoever switched itvehicles.getSirenState: read the sirenvehicles.setSiren: set the siren