attachVehicleOnToTrailer
ATTACH_VEHICLE_ON_TO_TRAILER0x16B5E274BDE402F8The GTA V native ATTACH_VEHICLE_ON_TO_TRAILER of the VEHICLE namespace, as LS:MP client scripts call it: the global function attachVehicleOnToTrailer, in JavaScript and in Lua.
attachVehicleOnToTrailer(
vehicle: Vehicle,
trailer: Vehicle,
offsetX: number,
offsetY: number,
offsetZ: number,
coordsX: number,
coordsY: number,
coordsZ: number,
rotationX: number,
rotationY: number,
rotationZ: number,
disableCollisions: number
): voidattachVehicleOnToTrailer(
vehicle: Vehicle,
trailer: Vehicle,
offsetX: number,
offsetY: number,
offsetZ: number,
coordsX: number,
coordsY: number,
coordsZ: number,
rotationX: number,
rotationY: number,
rotationZ: number,
disableCollisions: number
)Usage
attachVehicleOnToTrailer(
vehicle, trailer, offsetX, offsetY, offsetZ, coordsX, coordsY, coordsZ, rotationX, rotationY,
rotationZ, disableCollisions
);attachVehicleOnToTrailer(
vehicle, trailer, offsetX, offsetY, offsetZ, coordsX, coordsY, coordsZ, rotationX,
rotationY, rotationZ, disableCollisions
)Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
attachVehicleOnToTrailer(vehicle, trailer, offset, coords, rotation, disableCollisions);attachVehicleOnToTrailer(vehicle, trailer, offset, coords, rotation, disableCollisions)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
vehicle | Vehicle | number | integer |
trailer | Vehicle | number | integer |
offsetX | float | number | number |
offsetY | float | number | number |
offsetZ | float | number | number |
coordsX | float | number | number |
coordsY | float | number | number |
coordsZ | float | number | number |
rotationX | float | number | number |
rotationY | float | number | number |
rotationZ | float | number | number |
disableCollisions | float | number | number |
Returns
Nothing. In JavaScript the call evaluates to undefined.
On LS:MP
LS:MP's table describes the parameters of this native differently from the current native database (void ATTACH_VEHICLE_ON_TO_TRAILER(Vehicle vehicle, Vehicle trailer, float offsetX, float offsetY, float offsetZ, float coordsX, float coordsY, float coordsZ, float rotationX, float rotationY, float rotationZ, BOOL disableCollisions)). Until the table is refreshed, some values may be passed or returned under the wrong type.
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
This is the proper way of attaching vehicles to the car carrier, it's what Rockstar uses. Video Demo: https://www.youtube.com/watch?v=2lVEIzf7bgo
Reference
- Namespace
- Vehicle VEHICLE
- In the game
void ATTACH_VEHICLE_ON_TO_TRAILER(Vehicle vehicle, Vehicle trailer, float offsetX, float offsetY, float offsetZ, float coordsX, float coordsY, float coordsZ, float rotationX, float rotationY, float rotationZ, float disableCollisions)- Hash
0x16B5E274BDE402F8