DetachTrailerFromVehicle

From Multi Theft Auto: Wiki
Revision as of 14:51, 6 July 2006 by MrJax (talk | contribs)
Jump to navigation Jump to search

This function detaches an already attached trailer from a vehicle.

Syntax

bool detachTrailerFromVehicle ( vehicle theVehicle, [vehicle theTrailer] )

Required Arguments

  • theVehicle: The vehicle you wish to detach a trailer from.

Optional Arguments

  • theTrailer: The trailer you wish to be detached.

Note: If 'theTrailer' is specified, it will only detach if this matches. If it is not specified, any trailer attached to 'theVehicle' will be detached.

Returns

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

Example

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

vehicle = createVehicle ( 515, 500, 500, 40 ) -- create a trailer-tower (roadtrain)
trailer = createVehicle ( 435, 500, 505, 40 ) -- create a trailer
attachTrailerToVehicle ( vehicle, trailer ) -- attach them
detachTrailerFromVehicle ( vehicle ) -- detach any trailer from this vehicle

See Also