GetVehicleDoorOpenRatio: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(OOP) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
This function tells you how open a door is. Doors include boots/trunks and bonnets on vehicles that have them. | This function tells you how open a door is (the 'open ratio'). Doors include boots/trunks and bonnets on vehicles that have them. | ||
==Syntax== | ==Syntax== | ||
Line 7: | Line 7: | ||
float getVehicleDoorOpenRatio ( vehicle theVehicle, int door ) | float getVehicleDoorOpenRatio ( vehicle theVehicle, int door ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[vehicle]]:getDoorOpenRatio||setVehicleDoorOpenRatio}} | |||
==Required Arguments== | ==Required Arguments== | ||
*'''theVehicle:''' The [[vehicle]] that you wish to get the door open ratio of. | *'''theVehicle:''' The [[vehicle]] that you wish to get 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) | ||
==Returns== | ==Returns== | ||
Returns the door open | Returns a number between 0 and 1 that indicates how open the door is. 0 is closed, and 1 is fully open. Returns ''false'' if invalid arguments are passed. | ||
==Example== | ==Example== | ||
This example opens all the doors of the vehicle gradually over 2.5 seconds. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addCommandHandler ( "carshowoff", function ( playerSource ) | addCommandHandler ( "carshowoff", function ( playerSource ) |
Latest revision as of 23:45, 17 December 2014
This function tells you how open a door is (the 'open ratio'). Doors include boots/trunks and bonnets on vehicles that have them.
Syntax
float getVehicleDoorOpenRatio ( vehicle theVehicle, int door )
OOP Syntax Help! I don't understand this!
- Method: vehicle:getDoorOpenRatio(...)
- Counterpart: setVehicleDoorOpenRatio
Required Arguments
- theVehicle: The vehicle that you wish to get 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)
Returns
Returns a number between 0 and 1 that indicates how open the door is. 0 is closed, and 1 is fully open. Returns 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