- Documentation
- Server events
- onTrailerAttach
Event
onTrailerAttach
A trailer was attached to a vehicle.
Handler
addEventHandler("onTrailerAttach", root, function(theTruck) ... end)Parameters
theTruckvehicle- The towing vehicle.
Source
source is the trailer.
cancelEvent() blocks the attachment.
Example
addEventHandler("onTrailerAttach", root, function(truck)
local driver = getVehicleController(truck)
if driver then outputChatBox("Naczepa doczepiona.", driver) end
end)
See also
onTrailerDetachA trailer was detached.attachTrailerToVehicleAttaches a trailer or semi-trailer to a towing vehicle (truck, tractor, tow truck) for every player. Fires theonTrailerAttachevent on the trailer; if a script cancels it (cancelEvent), the trailer is not attached. Players can also attach trailers normally in the game by reversing a truck onto them.