setVehicleDoorOpenRatio | Multi Theft Auto: Wiki Skip to content

setVehicleDoorOpenRatio

Client-side
Server-side
Shared

Pair: getVehicleDoorOpenRatio

Manual Review Required

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


This function sets how much a vehicle's door is open. Doors include the boot/trunk and the bonnet of the vehicle.

OOP Syntax Help! I don't understand this!

  • Method:vehicle:setDoorOpenRatio(...)

Syntax

bool setVehicleDoorOpenRatio ( ​vehicle theVehicle, ​int door, ​float ratio, [ ​int time = 0 ] )
Required arguments
  • theVehicle: MISSING_PARAM_DESC
  • door: MISSING_PARAM_DESC
  • ratio: MISSING_PARAM_DESC
Optional arguments

Note: when using optional arguments, you might need to supply all arguments before the one you wish to use.

  • time (default: 0): MISSING_PARAM_DESC

Returns

Returns true if the door open ratio was successfully set, false if invalid arguments are passed.

  • bool: value

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