OnVehicleSirenStateChange

OnVehicleSirenStateChange

Description:
Callback OnVehicleSirenStateChange is called when a vehicle's siren is toggled.
Callback OnVehicleSirenStateChange was added in 0.3.7 and will not work in earlier versions!
  • Callback OnVehicleSirenStateChange can also be called by NPC.
  • Callback OnVehicleSirenStateChange is only called when a vehicle's siren is toggled on or off, NOT when the alternate siren is in use (holding horn).


Parameters:
(playerid, vehicleid, newstate)
int playerid The ID of the player that toggled the siren (driver).
int vehicleid The ID of the vehicle of which the siren was toggled for.
bool newstate 0 if siren was turned off, 1 if siren was turned on.


Return Values:
  • 1 - Will prevent gamemode from receiving this callback.
  • 0 - Indicates that this callback will be passed to the gamemode.
  • It is always called first in filterscripts.


Examples:
public OnVehicleSirenStateChange(playerid, vehicleid, newstate)
{
    if(newstate) GameTextForPlayer(playerid, "~W~Siren ~G~on", 1000, 3);
    else GameTextForPlayer(playerid, "~W~Siren ~r~off", 1000, 3);
    return 1;
}


Related Functions
The following functions may be useful, as they are related to this function in one way or another.