I am currently trying to attach a car to a trailer using code from a towing script Here So far I have looked everywhere and tried everything but I can get it. Here is the code (Just a snip of where it is used since everything else works):
local playerped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(playerped, true)
local trailer = GetVehicleTrailerVehicle(vehicle)
AttachEntityToEntity(targetVehicle, trailer, GetEntityBoneIndexByName(trailer 'misc_a'), 0.0 + xoff, -1.5 + yoff, 0.0 + zoff, 0, 0, 0, 1, 1, 0, 1, 0, 1)