GetVehicleLandingGearDown: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 15: Line 15:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This function tells you to pull up if you're flying low in a hydra with your landing gear up.
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( player )
blabhalbalhb --abababa
    vehicle = getPlayerOccupiedVehicle( player )    --Get the players vehicle
--This line does this...
    if ( ( getVehicleID(vehicle) == 520 ) and ( getVehicleLandingGearDown( vehicle ) == false ) ) then    --if the vehicle is a hydra, and the landing gear is up
mooo
        outputChatBox( "Pull up!", player )    --tell the player to pull up.
    end
end
</syntaxhighlight>
</syntaxhighlight>



Revision as of 14:03, 30 July 2007

This function is used to check whether a vehicles' landing gear is down or not.

Syntax

bool getVehicleLandingGearDown ( vehicle thevehicle )

Required Arguments

  • thevehicle: The vehicle that you wish to check its' 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 if you're flying low in a hydra with your landing gear up.

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

See Also