diff --git a/src/utils/getVehicle.ts b/src/utils/getVehicle.ts index c9ba511..6247e55 100644 --- a/src/utils/getVehicle.ts +++ b/src/utils/getVehicle.ts @@ -6,11 +6,24 @@ export function getVehicle(pedId: number) { } const licensePlate = GetVehicleNumberPlateText(vehicle); + const hasSirenEnabled = isSirenEnabled(vehicle); let vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))); if (vehicleName === "NULL") { vehicleName = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)); } - return { licensePlate, vehicle: vehicleName }; + return { licensePlate, vehicle: vehicleName, hasSirenEnabled }; +} + +function isSirenEnabled(vehicle: number) { + const sirenEnabledValue = + IsVehicleSirenOn(vehicle) || IsVehicleSirenAudioOn(vehicle) || IsVehicleSirenSoundOn(vehicle); + + // it can also return a number (1 or 0) + if (typeof sirenEnabledValue === "number") { + return sirenEnabledValue === 1; + } + + return sirenEnabledValue; }