ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. getVehicleTowingVehicle

Function

getVehicleTowingVehicle

ServerVehiclesIdentical to MTA:SA

Returns the vehicle that is towing the given trailer.

Syntax

vehicle getVehicleTowingVehicle(vehicle vehicle)

Arguments

vehiclevehicle
The trailer.

Returns

The towing vehicle, or false.

Example

addEventHandler("onTrailerAttach", root, function(towedBy)
    local truck = getVehicleTowingVehicle(source)
    local driver = truck and getVehicleController(truck)
    if driver and getElementType(driver) == "player" then outputChatBox("Naczepa podpieta.", driver) end
end)

See also