SetVehicleDoorOpenRatio: Difference between revisions
Jump to navigation
Jump to search
m (→Syntax) |
|||
(6 intermediate revisions by 4 users not shown) | |||
Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setVehicleDoorOpenRatio ( vehicle theVehicle, int door, float ratio [, int time ] ) | bool setVehicleDoorOpenRatio ( vehicle theVehicle, int door, float ratio [, int time = 0 ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[vehicle]]:setDoorOpenRatio||getVehicleDoorOpenRatio}} | |||
==Required Arguments== | ==Required Arguments== | ||
*'''theVehicle:''' The [[vehicle]] that you wish to change the door open ratio of. | *'''theVehicle:''' The [[vehicle]] that you wish to change the door open ratio of. | ||
*'''door:''' | *'''door:''' A whole number, 0 (hood), 1 (trunk), 2 (front left), 3 (front right), 4 (rear left), 5 (rear right) | ||
*'''ratio:''' The ratio value, ranging from 0 (fully closed) to 1 (fully open). | *'''ratio:''' The ratio value, ranging from 0 (fully closed) to 1 (fully open). | ||
==Optional Arguments== | ==Optional Arguments== | ||
{{OptionalArg}} | {{OptionalArg}} | ||
*'''time:''' The | *'''time:''' The number of milliseconds the door should take to reach the value you have specified. A value of 0 will change the door open ratio instantly. | ||
==Returns== | ==Returns== |
Latest revision as of 20:00, 25 July 2018
This function sets how much a vehicle's door is open. Doors include the boot/trunk and the bonnet of the vehicle.
Syntax
bool setVehicleDoorOpenRatio ( vehicle theVehicle, int door, float ratio [, int time = 0 ] )
OOP Syntax Help! I don't understand this!
- Method: vehicle:setDoorOpenRatio(...)
- Counterpart: getVehicleDoorOpenRatio
Required Arguments
- theVehicle: The vehicle that you wish to change the door open ratio of.
- door: A whole number, 0 (hood), 1 (trunk), 2 (front left), 3 (front right), 4 (rear left), 5 (rear right)
- ratio: The ratio value, ranging from 0 (fully closed) to 1 (fully open).
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- time: The number of milliseconds the door should take to reach the value you have specified. A value of 0 will change the door open ratio instantly.
Returns
Returns true if the door open ratio was successfully set, false if invalid arguments are passed.
Example
This example opens all the doors of the vehicle gradually over 2.5 seconds.
addCommandHandler ( "carshowoff", function ( playerSource ) local vehicle = getPedOccupiedVehicle ( playerSource ) if vehicle then for i=0,5 do setVehicleDoorOpenRatio ( vehicle, i, 1 - getVehicleDoorOpenRatio ( vehicle, i ), 2500 ) 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