setVehicleDoorOpenRatio
Shared
Opens or closes one or more doors of a vehicle to a fraction, at once or over time.
bool setVehicleDoorOpenRatio(element vehicle, int|string|table door, float ratio [, int time = 0])
Parameters
| Name | Type | Description |
|---|---|---|
| vehicle | element | The vehicle, or a parent element whose vehicles all change. |
| door | int|string|table | Which door: its number (0 the front lid, 1 the rear lid, 2 and 3 the front doors on the driver's and the passenger's side, 4 and 5 the rear ones), its frame name (door_dside_f; left and right in place of dside and pside follow the vehicle's driving side), a group (all, side_doors, front_doors, rear_doors, left_doors, right_doors), -1 for all of them or a table of several. |
| ratio | float | From 0 (shut) to 1 (fully open). Values outside are clamped. |
| time | int | Time in milliseconds to get there. 0 moves it at once.default 0 |
Returns
true if any door was moved, false if the vehicle lacks the door.
Given a parent element such as root, it applies to every vehicle below it, but the value returned is the element's own: false when it is not a vehicle.
Example
addCommandHandler("capo", function(player)
local vehicle = getPedOccupiedVehicle(player)
if vehicle then
setVehicleDoorOpenRatio(vehicle, 0, 1, 1500)
end
end)