SetTrainDoorOpenRatio
DocsSetTrainDoorOpenRatio(train, doorIndex, ratio)Description
Sets the ratio that a door is open for on a train.
Parameters
| Name | Type | Description |
|---|---|---|
train | Vehicle | The train to set the door ratio for. |
doorIndex | int | Zero-based door index. |
ratio | float | A value between 0.0 (fully closed) and 1.0 (fully open). |
Quick Snippet: Get Vehicletrain
trainUse this to get the current vehicle handle for this native.
-- Get the vehicle the player is currently in
local ped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(ped, false)
if vehicle ~= 0 then
print("Vehicle handle: " .. vehicle)
print("Model: " .. GetEntityModel(vehicle))
else
print("Player is not in a vehicle")
endVehicle Models

adder
alpha
blade
ardent
asea
cogcabrio
baller
blistaReturns
voidThis native does not return a value.
Examples
Official
-- open all doors on a train
local doorCount = GetTrainDoorCount(train)
for doorIndex = 0, doorCount - 1 do
SetTrainDoorOpenRatio(train, doorIndex, 1.0)
end