IsVehicleWheelOnGround: Difference between revisions
Jump to navigation
Jump to search
Dutchman101 (talk | contribs) mNo edit summary |
mNo edit summary |
||
Line 2: | Line 2: | ||
{{Client function}} | {{Client function}} | ||
{{New feature/item|3.0160|1.5.5|11854| | {{New feature/item|3.0160|1.5.5|11854| | ||
This function returns a boolean whether the [[vehicle]]'s wheel is on ground (true) or in air (false). | This function returns a [[boolean]] whether the [[vehicle]]'s wheel is on ground (true) or in air (false). | ||
}} | }} | ||
{{Note|In vehicles with 3 wheels, the wheels are combined 2 in 1, in motorbikes only the left - <code>"front_left"</code> and <code>"rear_left"</code>}} | {{Note|In vehicles with 3 wheels, the wheels are combined 2 in 1, in motorbikes only the left - <code>"front_left"</code> and <code>"rear_left"</code>}} | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool isVehicleWheelCollided ( vehicle theVehicle, string| | <syntaxhighlight lang="lua">bool isVehicleWheelCollided ( vehicle theVehicle, string|int wheel )</syntaxhighlight> | ||
{{OOP||[[vehicle]]:isWheelCollided}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle''' The [[vehicle]], which you want to check. | *'''theVehicle''' The [[vehicle]], which you want to check. | ||
Line 24: | Line 24: | ||
This example allows a player to lock his vehicle when he is inside it. | This example allows a player to lock his vehicle when he is inside it. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
Green = tocolor(0,255,0,255) | local Green = tocolor(0, 255, 0, 255) | ||
Red = tocolor(255,0,0,255) | local Red = tocolor(255, 0, 0, 255) | ||
addEventHandler("onClientRender",root,function() | |||
addEventHandler( "onClientRender", root, | |||
function( ) | |||
local theVehicle = getPedOccupiedVehicle( localPlayer ) | |||
if isElement( theVehicle ) then | |||
dxDrawRectangle( 100, 100, 20, 20, isVehicleWheelCollided( theVehicle, 0 ) and Green or Red ) | |||
dxDrawRectangle( 100, 140, 20, 20, isVehicleWheelCollided( theVehicle, 1 ) and Green or Red ) | |||
dxDrawRectangle( 140, 100, 20, 20, isVehicleWheelCollided( theVehicle, 2 ) and Green or Red ) | |||
dxDrawRectangle( 140, 140, 20, 20, isVehicleWheelCollided( theVehicle, 3 ) and Green or Red ) | |||
end | |||
end | end | ||
) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> |
Revision as of 00:34, 2 July 2018
This function returns a boolean whether the vehicle's wheel is on ground (true) or in air (false).
Syntax
bool isVehicleWheelCollided ( vehicle theVehicle, string|int wheel )
OOP Syntax Help! I don't understand this!
- Method: vehicle:isWheelCollided(...)
Required Arguments
- theVehicle The vehicle, which you want to check.
- wheel The wheel name or number, see list below:
"front_left"
or 0"rear_left"
or 1"front_right"
or 2"rear_right"
or 3
Returns
Returns true if the vehicle wheel is on ground/collided, false otherwise.
Example
Click to collapse [-]
ClientThis example allows a player to lock his vehicle when he is inside it.
local Green = tocolor(0, 255, 0, 255) local Red = tocolor(255, 0, 0, 255) addEventHandler( "onClientRender", root, function( ) local theVehicle = getPedOccupiedVehicle( localPlayer ) if isElement( theVehicle ) then dxDrawRectangle( 100, 100, 20, 20, isVehicleWheelCollided( theVehicle, 0 ) and Green or Red ) dxDrawRectangle( 100, 140, 20, 20, isVehicleWheelCollided( theVehicle, 1 ) and Green or Red ) dxDrawRectangle( 140, 100, 20, 20, isVehicleWheelCollided( theVehicle, 2 ) and Green or Red ) dxDrawRectangle( 140, 140, 20, 20, isVehicleWheelCollided( theVehicle, 3 ) and Green or Red ) end end )
See Also
- areVehicleLightsOn
- getHeliBladeCollisionsEnabled
- getHelicopterRotorSpeed
- getVehicleAdjustableProperty
- getVehicleComponentPosition
- getVehicleComponentRotation
- getVehicleComponents
- getVehicleComponentScale
- getVehicleComponentVisible
- getVehicleCurrentGear
- getVehicleDummyPosition
- getVehicleGravity
- getVehicleLandingGearDown
- getVehicleModelDummyDefaultPosition
- getVehicleModelDummyPosition
- getVehicleModelExhaustFumesPosition
- getVehicleModelWheelSize
- getVehicleNitroCount
- getVehicleNitroLevel
- getVehicleWheelFrictionState
- getVehicleWheelScale
- isTrainChainEngine
- isVehicleNitroActivated
- isVehicleNitroRecharging
- isVehicleOnGround
- isVehicleWheelOnGround
- isVehicleWindowOpen
- resetVehicleComponentPosition
- resetVehicleComponentRotation
- resetVehicleComponentScale
- resetVehicleDummyPositions
- setHeliBladeCollisionsEnabled
- setHelicopterRotorSpeed
- setVehicleAdjustableProperty
- setVehicleComponentPosition
- setVehicleComponentRotation
- setVehicleComponentScale
- setVehicleComponentVisible
- setVehicleDummyPosition
- setVehicleGravity
- setVehicleLandingGearDown
- setVehicleModelDummyPosition
- setVehicleModelExhaustFumesPosition
- setVehicleModelWheelSize
- setVehicleNitroActivated
- setVehicleNitroCount
- setVehicleNitroLevel
- setVehicleWheelScale
- setVehicleWheelStates
- setVehicleWindowOpen
- Shared
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates