getVehicleDoorOpenRatio | Multi Theft Auto: Wiki Skip to content

getVehicleDoorOpenRatio

Client-side
Server-side
Shared

Pair: setVehicleDoorOpenRatio

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function tells you how open a door is (the 'open ratio'). Doors include boots/trunks and bonnets on vehicles that have them.

OOP Syntax Help! I don't understand this!

  • Method:vehicle:getDoorOpenRatio(...)

Syntax

float getVehicleDoorOpenRatio ( vehicle theVehicle, int door )
Required Arguments
  • theVehicle: MISSING_PARAM_DESC
  • door: MISSING_PARAM_DESC

Returns

  • float: value

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.

Code Examples

shared

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

Vehicle Functions