GetVehicleLandingGearDown: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(10 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
{{Server client function}}
This fake function is for use with blah & blah and does blahblahblabhalbhl
This function is used to check whether a vehicle's landing gear is down or not. Only planes can be used with this function.


==Syntax==  
==Syntax==  
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool getVehicleLandingGearDown ( vehicle thevehicle )
bool getVehicleLandingGearDown ( vehicle theVehicle )
</syntaxhighlight>  
</syntaxhighlight>  
 
{{OOP||[[vehicle]]:getLandingGearDown|landingGearDown|setVehicleLandingGearDown}}
===Required Arguments===  
===Required Arguments===  
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
*'''theVehicle:''' the [[vehicle]] of which you wish to check the landing gear state.
*'''argumentName:''' description
 
<!-- Only include this section below if there are optional arguments -->
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' description
*'''argumentName3:''' description


===Returns===
===Returns===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns ''true'' if landing gear is down, ''false'' if the landing gear is up.<br />
Returns ''true'' if blah, ''false'' otherwise.
Returns ''nil'' if the vehicle has no landing gear, or is invalid.
Returns ''nil'' for an error (No landing gear on the vehicle checked)


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This function tells you to pull up the landing gear if you're in a Hydra with its landing gear down.
This example does...
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function checkGear( thePlayer )
blabhalbalhb --abababa
    local theVehicle = getPedOccupiedVehicle( thePlayer )    --Get the players vehicle
--This line does this...
    if ( getElementModel(theVehicle) == 520 and getVehicleLandingGearDown( theVehicle ) == false ) then    --if the vehicle is a hydra, and the landing gear is up
mooo
        outputChatBox( "Pull up!", thePlayer )    --tell the player to pull up.
    end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{Vehicle functions}}
{{Vehicle functions}}
[[Category:Incomplete]]
[[ru:getVehicleLandingGearDown ]]

Latest revision as of 06:24, 17 June 2023

This function is used to check whether a vehicle's landing gear is down or not. Only planes can be used with this function.

Syntax

bool getVehicleLandingGearDown ( vehicle theVehicle )

OOP Syntax Help! I don't understand this!

Method: vehicle:getLandingGearDown(...)
Variable: .landingGearDown
Counterpart: setVehicleLandingGearDown


Required Arguments

  • theVehicle: the vehicle of which you wish to check the landing gear state.

Returns

Returns true if landing gear is down, false if the landing gear is up.
Returns nil if the vehicle has no landing gear, or is invalid.

Example

This function tells you to pull up the landing gear if you're in a Hydra with its landing gear down.

function checkGear( thePlayer )
    local theVehicle = getPedOccupiedVehicle( thePlayer )    --Get the players vehicle
    if ( getElementModel(theVehicle) == 520 and getVehicleLandingGearDown( theVehicle ) == false ) then    --if the vehicle is a hydra, and the landing gear is up
        outputChatBox( "Pull up!", thePlayer )    --tell the player to pull up.
    end
end

See Also