- Documentation
- Server functions
- getVehicleTowedByVehicle
Function
getVehicleTowedByVehicle
Returns the trailer the given vehicle is towing.
Syntax
vehicle getVehicleTowedByVehicle(vehicle vehicle)Arguments
vehiclevehicle- The towing vehicle.
Returns
The trailer, or false when the vehicle is not towing anything.
Example
addCommandHandler("ladunek", function(player)
local truck = getPedOccupiedVehicle(player)
local trailer = truck and getVehicleTowedByVehicle(truck)
outputChatBox(trailer and ("Ciagniesz: " .. getVehicleName(trailer)) or "Brak naczepy.", player)
end)
See also
getVehicleTowingVehicleReturns the vehicle that is towing the given trailer.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.