onTrailerAttach
ServerEventCancellable
Fired on the server when a trailer is hitched to a vehicle. Cancelling the event unhitches the trailer.
addEventHandler("onTrailerAttach", root, function(vehicle towedBy) … end)
Handler parameters
| Name | Type | Description |
|---|---|---|
| towedBy | vehicle | The vehicle now towing the trailer. |
Source
The trailer.
Example
addEventHandler("onTrailerAttach", root, function(towedBy)
if isVehicleLocked(source) then
cancelEvent()
end
end)