GetVehicleParamsSirenState

From SA-MP Wiki

Jump to: navigation, search

GetVehicleParamsSirenState was added in SA-MP 0.3.7 This function was added in SA-MP 0.3.7 and will not work in earlier versions!


Description:

Returns a vehicle's siren state (on/off).


Parameters:
(vehicleid)
vehicleidThe ID of the vehicle to get the siren state of.


Return Values:

  • -1: Vehicle siren hasn't been set yet (off)
  • 0: Vehicle siren is off
  • 1: Vehicle siren is on


Image:32px-Circle-style-warning.png

Important
Note

Because a siren state of -1 or 0 means 'off', you cannot use a boolean conditional statement to check whether sirens are on. If you do 'if(sirenstate)', it will be true for anything NOT 0 (so -1 or 1). You should check that the siren state explicitly equals 1.


new siren = GetVehicleParamsSirenState(vehicleid);
 
if(siren == 1)
{
    // Siren is on, do something
}
else
{
    // Siren is off, do something
}

Related Callbacks

The following callbacks might be useful, as they're related to this function in one way or another.

Personal tools