SetVehicleSirensOn: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function changes the state of the sirens on the specified vehicle. | This function changes the state of the sirens on the specified vehicle. | ||
Line 17: | Line 15: | ||
==Example== | ==Example== | ||
This example | This example toggles siren state when a player enters a vehicle as a driver. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | addEventHandler ( "onVehicleEnter", getRootElement(), "example_onVehicleEnter" ) | ||
function example_onVehicleEnter ( player, seat, jacked ) | |||
-- | --If the player entered as a driver | ||
if seat == 0 then | |||
--If siren was off | |||
if not getVehicleSirensOn ( source ) then | |||
setVehicleSirenOn ( source, true ) --Turn it on | |||
else | |||
setVehicleSirenOn ( source, false ) --Turn it off | |||
end | |||
end | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{ | {{Vehicle functions}} |
Revision as of 17:12, 11 January 2007
This function changes the state of the sirens on the specified vehicle.
Syntax
bool setVehicleSirenOn ( vehicle theVehicle , bool sirensOn )
Required Arguments
- theVehicle: The vehicle that will have the sirens set
- sirensOn: The state to set the sirens to
Returns
Returns true if the sirens are set for the specified vehicle, false if the sirens can't be set for the specified vehicle, if the vehicle doesn't have sirens or if invalid arguments are specified.
Example
This example toggles siren state when a player enters a vehicle as a driver.
addEventHandler ( "onVehicleEnter", getRootElement(), "example_onVehicleEnter" ) function example_onVehicleEnter ( player, seat, jacked ) --If the player entered as a driver if seat == 0 then --If siren was off if not getVehicleSirensOn ( source ) then setVehicleSirenOn ( source, true ) --Turn it on else setVehicleSirenOn ( source, false ) --Turn it off end end end
See Also
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates