VehicleClient

getTrainCarriage

GET_TRAIN_CARRIAGE0x08AAFD0814722BC3

The GTA V native GET_TRAIN_CARRIAGE of the VEHICLE namespace, as LS:MP client scripts call it: the global function getTrainCarriage, in JavaScript and in Lua.

SignatureJavaScript
getTrainCarriage(train: Vehicle, trailerNumber: number): Vehicle
SignatureLua
getTrainCarriage(train: Vehicle, trailerNumber: integer): Vehicle

Usage

JavaScript
const vehicle = getTrainCarriage(train, trailerNumber);
Lua
local vehicle = getTrainCarriage(train, trailerNumber)

Parameters

ParameterTypeJavaScriptLua
trainVehiclenumberinteger
trailerNumberintnumberinteger

Returns

Vehicle JavaScript number, Lua integer

Game handle of a vehicle. Not an LS:MP netId. Convert one with lsmp.getEntityFromNetId.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Corrected p1. it's basically the 'carriage/trailer number'. So if the train has 3 trailers you'd call the native once with a var or 3 times with 1, 2, 3.

Reference

Namespace
Vehicle VEHICLE
In the game
Vehicle GET_TRAIN_CARRIAGE(Vehicle train, int trailerNumber)
Hash
0x08AAFD0814722BC3

Open in the interactive natives reference