SetVehicleSirensOn: Difference between revisions
Jump to navigation
Jump to search
(OOP) |
|||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
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 6: | Line 7: | ||
bool setVehicleSirensOn ( vehicle theVehicle , bool sirensOn ) | bool setVehicleSirensOn ( vehicle theVehicle , bool sirensOn ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[vehicle]]:setSirensOn|sirensOn|getVehicleSirensOn}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle:''' The vehicle that will have the sirens set | *'''theVehicle:''' The vehicle that will have the sirens set | ||
Line 15: | Line 16: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | |||
This example toggles siren state when a player enters a vehicle as a driver. | This example toggles siren state when a player enters a vehicle as a driver. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function example_onVehicleEnter ( | function example_onVehicleEnter ( thePlayer, seat, jacked ) | ||
--If the player entered as a driver | --If the player entered as a driver | ||
if ( seat == 0 ) then | if ( seat == 0 ) then | ||
--If siren was off | --If siren was off | ||
if not getVehicleSirensOn ( source ) then | if not getVehicleSirensOn ( source ) then | ||
setVehicleSirensOn ( source, true ) --Turn it on | setVehicleSirensOn ( source, true ) --Turn it on | ||
else | else | ||
setVehicleSirensOn ( source, false ) --Turn it off | setVehicleSirensOn ( source, false ) --Turn it off | ||
end | end | ||
end | end | ||
Line 30: | Line 32: | ||
addEventHandler ( "onVehicleEnter", getRootElement(), example_onVehicleEnter ) | addEventHandler ( "onVehicleEnter", getRootElement(), example_onVehicleEnter ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Latest revision as of 23:17, 17 December 2014
This function changes the state of the sirens on the specified vehicle.
Syntax
bool setVehicleSirensOn ( vehicle theVehicle , bool sirensOn )
OOP Syntax Help! I don't understand this!
- Method: vehicle:setSirensOn(...)
- Variable: .sirensOn
- Counterpart: getVehicleSirensOn
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
Click to collapse [-]
ServerThis example toggles siren state when a player enters a vehicle as a driver.
function example_onVehicleEnter ( thePlayer, seat, jacked ) --If the player entered as a driver if ( seat == 0 ) then --If siren was off if not getVehicleSirensOn ( source ) then setVehicleSirensOn ( source, true ) --Turn it on else setVehicleSirensOn ( source, false ) --Turn it off end end end addEventHandler ( "onVehicleEnter", getRootElement(), example_onVehicleEnter )
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