OnVehicleSirenStateChange

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 22:13, 3 May 2015
Tyler12 (Talk | contribs)
(Add else statement)
← Previous diff
Current revision
OstGot (Talk | contribs)

Line 9: Line 9:
{{Param|newstate|0 if siren was turned off, 1 if siren was turned on.}} {{Param|newstate|0 if siren was turned off, 1 if siren was turned on.}}
-{{NoReturnCallback}}+{{Returns|
 +* '''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.}}
{{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).}} {{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).}}

Current revision


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.


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.

Personal tools