GetVehicleTowingVehicle: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 1: Line 1:
__NOTOC__
{{Server client function}}
{{Server client function}}
__NOTOC__
This function is used to get the vehicle that is towing another.
This function is used to get the vehicle that is towing another.


Line 7: Line 7:


===Required Arguments===
===Required Arguments===
*'''theVehicle''': The [[vehicle]] being towed.
*'''theVehicle''': the [[vehicle]] being towed.


==Returns==
==Returns==
Returns the vehicle that ''theVehicle'' is being towed by, ''false'' if it isn't being towed.
* The vehicle that ''theVehicle'' is being towed by.
* ''false'' if it isn't being towed.


==Example==
==Example==

Revision as of 22:25, 4 October 2014

This function is used to get the vehicle that is towing another.

Syntax

vehicle getVehicleTowingVehicle ( vehicle theVehicle )

Required Arguments

  • theVehicle: the vehicle being towed.

Returns

  • The vehicle that theVehicle is being towed by.
  • false if it isn't being towed.

Example

This example will create a trailer and a trailer-tower, attach them, then check if they attached.

local towingVehicle = createVehicle ( 515, 500, 500, 40 ) -- create a trailer-tower (roadtrain)
local trailer = createVehicle ( 435, 500, 490, 40 ) -- create a trailer
attachTrailerToVehicle ( towingVehicle, trailer ) -- attach them
if ( getVehicleTowingVehicle ( trailer ) == towingVehicle ) then -- if it attached
  outputChatBox ( "The vehicles were attached!" )
end

See Also