GetVehicleTowedByVehicle: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(OOP)
 
(4 intermediate revisions by one other user not shown)
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">vehicle getVehicleTowedByVehicle ( vehicle theVehicle )</syntaxhighlight>
<syntaxhighlight lang="lua">vehicle getVehicleTowedByVehicle ( vehicle theVehicle )</syntaxhighlight>
 
{{OOP||[[vehicle]]:getTowedByVehicle|towedByVehicle}}
===Required Arguments===
===Required Arguments===
*'''theVehicle''': The [[vehicle]] you wish to get the towed vehicle from.
*'''theVehicle''': The [[vehicle]] you wish to get the towed vehicle from.


==Returns==
==Returns==
Returns the vehicle that 'theVehicle' is towing, 'nil' if it isn't towing a vehicle.
Returns the vehicle that ''theVehicle'' is towing, ''false'' if it isn't towing a vehicle.


==Example==
==Example==
This example will create a trailer and a trailer-tower, attach them, then check if they attached.
This example will create a trailer and a trailer-tower, attach them, then check if they attached.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
towingVehicle = createVehicle ( 515, 500, 500, 40 ) -- create a trailer-tower (roadtrain)
local towingVehicle = createVehicle ( 515, 500, 500, 40 ) -- create a trailer-tower (roadtrain)
trailer = createVehicle ( 435, 500, 505, 40 ) -- create a trailer
local trailer = createVehicle ( 435, 500, 490, 40 ) -- create a trailer
attachTrailerToVehicle ( towingVehicle, trailer ) -- attach them
attachTrailerToVehicle ( towingVehicle, trailer ) -- attach them
if ( getVehicleTowedByVehicle ( towingVehicle ) == trailer ) then -- if it attached
if ( getVehicleTowedByVehicle ( towingVehicle ) == trailer ) then -- if it attached

Latest revision as of 23:11, 17 December 2014

This function is used to get the vehicle being towed by another.

Syntax

vehicle getVehicleTowedByVehicle ( vehicle theVehicle )

OOP Syntax Help! I don't understand this!

Method: vehicle:getTowedByVehicle(...)
Variable: .towedByVehicle


Required Arguments

  • theVehicle: The vehicle you wish to get the towed vehicle from.

Returns

Returns the vehicle that theVehicle is towing, false if it isn't towing a vehicle.

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 ( getVehicleTowedByVehicle ( towingVehicle ) == trailer ) then -- if it attached
  outputChatBox ( "The vehicles were attached!" )
end

See Also