SetVehicleEngineState: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
This function changes the on/off state of a vehicle's engine | This function changes the on/off state of a vehicle's engine | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool setVehicleEngineState ( vehicle theVehicle, bool | <syntaxhighlight lang="lua">bool setVehicleEngineState ( vehicle theVehicle, bool engineOn )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle''': The [[vehicle]] you wish to change the engine state of. | *'''theVehicle''': The [[vehicle]] you wish to change the engine state of. | ||
*''' | *'''engineOn''': A boolean value representing whether or not the engine will be turned on or off. | ||
==Returns== | ==Returns== | ||
Returns 'true' if the vehicle's engine state was successfully changed, 'false' otherwise. | Returns ''true'' if the vehicle's engine state was successfully changed, ''false'' otherwise. | ||
==Example== | ==Example== | ||
This example will disallow the use of the engine in any vehicle | This example will disallow the use of the engine in any vehicle. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function onPlayerEnterVehicle ( theVehicle, seat, jacked ) | function onPlayerEnterVehicle ( theVehicle, seat, jacked ) | ||
if seat == 0 then -- if they're getting into the driver seat | |||
setVehicleEngineState ( theVehicle, false ) -- turn off the engine | |||
end | |||
end | end | ||
addEventHandler ( "onPlayerEnterVehicle", getRootElement ( ), onPlayerEnterVehicle ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Revision as of 20:35, 15 August 2007
This function changes the on/off state of a vehicle's engine
Syntax
bool setVehicleEngineState ( vehicle theVehicle, bool engineOn )
Required Arguments
- theVehicle: The vehicle you wish to change the engine state of.
- engineOn: A boolean value representing whether or not the engine will be turned on or off.
Returns
Returns true if the vehicle's engine state was successfully changed, false otherwise.
Example
This example will disallow the use of the engine in any vehicle.
function onPlayerEnterVehicle ( theVehicle, seat, jacked ) if seat == 0 then -- if they're getting into the driver seat setVehicleEngineState ( theVehicle, false ) -- turn off the engine end end addEventHandler ( "onPlayerEnterVehicle", getRootElement ( ), onPlayerEnterVehicle )
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