AttachTrailerToVehicle

From Multi Theft Auto: Wiki

This function attaches a trailer type vehicle to a trailer-towing-type vehicle.

Syntax

bool attachTrailerToVehicle ( vehicle theVehicle, vehicle theTrailer )

OOP Syntax Help! I don't understand this!

Method: vehicle:attachTrailer(...)

Required Arguments

  • theVehicle: the vehicle you wish to attach a trailer to.
  • theTrailer: the trailer you wish to be attached.

Returns

Returns true if the vehicle's were successfully attached, false otherwise.

Example

This example will create a trailer and a trailer tower, then attach them.

newvehicle = createVehicle ( 515, 0, 0, 4 ) -- create a trailer tower (roadtrain)
setTimer(
	function()
		trailer = createVehicle ( 435, 0, 0, 4 )    -- create a trailer
		attachTrailerToVehicle ( newvehicle, trailer )   -- attach them
	end, 50, 1)

See Also

FROM VERSION 1.5.7 r19626 ONWARDS
FROM VERSION 1.6 r7485 ONWARDS
FROM VERSION 1.6 r7485 ONWARDS