OnClientTrailerAttach: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 14: Line 14:
==Example==
==Example==
This example shows on chat name of vehicle, what attach a trailer.
This example shows on chat name of vehicle, what attach a trailer.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">function onAttach(vehicle)
function onAttach(vehicle)
local name = getVehicleName(vehicle)
local name = getVehicleName(vehicle)
outputChatBox("You are attached the trailer by "..name)
outputChatBox("You were attach the trailer by "..name)
end
end
addEventHandler("onClientTrailerAttach", getRootElement(), onAttach)
addEventHandler("onClientTrailerAttach", getRootElement(), onAttach)</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
Line 27: Line 25:
===Client event functions===
===Client event functions===
{{Client_event_functions}}
{{Client_event_functions}}
[[es:onClientTrailerAttach]]

Latest revision as of 19:56, 22 September 2016

This event is triggered by a trailer when it gets attached to a towing vehicle.

Parameters

vehicle towedBy
  • towedBy: the vehicle that is now towing the trailer.

Source

The source of this event is the trailer that is now being towed.

Example

This example shows on chat name of vehicle, what attach a trailer.

function onAttach(vehicle)
	local name = getVehicleName(vehicle)
	outputChatBox("You were attach the trailer by "..name)
end
addEventHandler("onClientTrailerAttach", getRootElement(), onAttach)

See Also

Client vehicle events


Client event functions