GetVehicleEngineState: Difference between revisions
Jump to navigation
Jump to search
(→Example: fixed a typo) |
m (invalid template) |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
This function returns a vehicle's engine state (on or off). | {{New feature/item|3|1.0||This function returns a vehicle's engine state (on or off).}} | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool getVehicleEngineState ( vehicle theVehicle ) | bool getVehicleEngineState ( vehicle theVehicle ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[vehicle]]:getEngineState|engineState|setVehicleEngineState}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle''': | *'''theVehicle''': the [[vehicle]] you wish to get the engine state of. | ||
===Returns=== | ===Returns=== | ||
Returns '''true''' if the vehicle's engine is started, '''false''' otherwise. | Returns '''true''' if the vehicle's engine is started, '''false''' otherwise. | ||
==Example== | ==Example== | ||
Line 21: | Line 18: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function switchEngine ( playerSource ) | function switchEngine ( playerSource ) | ||
local theVehicle = | local theVehicle = getPedOccupiedVehicle ( playerSource ) | ||
-- Check if the player is in any vehicle and if he is the driver | -- Check if the player is in any vehicle and if he is the driver | ||
Line 35: | Line 32: | ||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} | ||
Latest revision as of 18:59, 19 September 2018
This function returns a vehicle's engine state (on or off).
Syntax
bool getVehicleEngineState ( vehicle theVehicle )
OOP Syntax Help! I don't understand this!
- Method: vehicle:getEngineState(...)
- Variable: .engineState
- Counterpart: setVehicleEngineState
Required Arguments
- theVehicle: the vehicle you wish to get the engine state of.
Returns
Returns true if the vehicle's engine is started, false otherwise.
Example
Click to collapse [-]
Serverside exampleThis example will switch the vehicle engine state with the command "/switchengine".
function switchEngine ( playerSource ) local theVehicle = getPedOccupiedVehicle ( playerSource ) -- Check if the player is in any vehicle and if he is the driver if theVehicle and getVehicleController ( theVehicle ) == playerSource then local state = getVehicleEngineState ( theVehicle ) setVehicleEngineState ( theVehicle, not state ) end end addCommandHandler ( "switchengine", switchEngine )
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