OnVehicleSirenStateChange

From SA-MP Wiki

Jump to: navigation, search

OnVehicleSirenStateChange was added in SA-MP 0.3.7 This callback was added in SA-MP 0.3.7 and will not work in earlier versions!


Description:

This callback is called when a vehicle's siren is toggled.


Image:32px-Ambox_warning_orange.png

Note

This callback can also be called by NPC.


Parameters:
(playerid, vehicleid, newstate)
playeridThe ID of the player that toggled the siren (driver).
vehicleidThe ID of the vehicle of which the siren was toggled for.
newstate0 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.


Image:32px-Ambox_warning_orange.png

Note

This callback is only called when a vehicle's siren is toggled on or off, NOT when the alternate siren is in use (holding horn).


Example Usage:

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.