VehicleClient

attachVehicleToTowTruck

ATTACH_VEHICLE_TO_TOW_TRUCK0x29A16F8D621C4508

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

SignatureJavaScript
attachVehicleToTowTruck(
  towTruck: Vehicle,
  vehicle: Vehicle,
  rear: boolean,
  hookOffsetX: number,
  hookOffsetY: number,
  hookOffsetZ: number
): void
SignatureLua
attachVehicleToTowTruck(
  towTruck: Vehicle,
  vehicle: Vehicle,
  rear: boolean,
  hookOffsetX: number,
  hookOffsetY: number,
  hookOffsetZ: number
)

Usage

JavaScript
attachVehicleToTowTruck(towTruck, vehicle, rear, hookOffsetX, hookOffsetY, hookOffsetZ);
Lua
attachVehicleToTowTruck(towTruck, vehicle, rear, hookOffsetX, hookOffsetY, hookOffsetZ)

Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.

JavaScript · with vectors
attachVehicleToTowTruck(towTruck, vehicle, rear, hookOffset);
Lua · with vectors
attachVehicleToTowTruck(towTruck, vehicle, rear, hookOffset)

Parameters

ParameterTypeJavaScriptLua
towTruckVehiclenumberinteger
vehicleVehiclenumberinteger
rearBOOLbooleanboolean
hookOffsetXfloatnumbernumber
hookOffsetYfloatnumbernumber
hookOffsetZfloatnumbernumber

Returns

Nothing. In JavaScript the call evaluates to undefined.

Notes

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

HookOffset defines where the hook is attached. leave at 0 for default attachment.

Reference

Namespace
Vehicle VEHICLE
In the game
void ATTACH_VEHICLE_TO_TOW_TRUCK(Vehicle towTruck, Vehicle vehicle, BOOL rear, float hookOffsetX, float hookOffsetY, float hookOffsetZ)
Hash
0x29A16F8D621C4508

Open in the interactive natives reference