This event is triggered when a trailer is attached to a truck.
- theTruck: the truck vehicle that got attached to this trailer.
If this event is canceled, the trailer will detach from the truck again.
This example removes a trailer from the truck it is attached to. Good if you do not want people attaching trailers to vehicles
function detachTrailer(theTruck) detachTrailerFromVehicle(theTruck, source) --detach the newly attached trailer end addEventHandler("onTrailerAttach", getRootElement(), detachTrailer)