GetVehicleLandingGearDown: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{server client function}}
{{server client function}}
This function is used to check whether a vehicles' landing gear is down or not. Only planes can be used with this function.
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==  
Line 9: Line 9:


===Required Arguments===  
===Required Arguments===  
*'''thevehicle:''' The vehicle that you wish to check its' landing gear state.
*'''thevehicle:''' The vehicle of which you wish to check the landing gear state.


===Returns===
===Returns===
Line 16: Line 16:


==Example==  
==Example==  
This function tells you to pull up if you're flying low in a hydra with your landing gear up.
This function tells you to pull up the landing gear if you're in a Hydra with its landing gear down.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function checkGear( player )
function checkGear( thePlayer )
     vehicle = getPlayerOccupiedVehicle( player )    --Get the players vehicle
     local theVehicle = getPlayerOccupiedVehicle( thePlayer )    --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
     if ( getVehicleID(theVehicle) == 520 and getVehicleLandingGearDown( theVehicle ) == false ) then    --if the vehicle is a hydra, and the landing gear is up
         outputChatBox( "Pull up!", player )    --tell the player to pull up.
         outputChatBox( "Pull up!", thePlayer )    --tell the player to pull up.
     end
     end
end
end

Revision as of 17:27, 17 August 2007

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 )

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 = getPlayerOccupiedVehicle( thePlayer )    --Get the players vehicle
    if ( getVehicleID(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