GetVehicleWheelFrictionState: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Client function}} | {{Client function}} | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{Added feature/item|1.5.9|1.5.8|20726|This function returns the current wheel friction state of the [[vehicle]].}} | ||
==Syntax== | ==Syntax== | ||
Line 23: | Line 23: | ||
==Example== | ==Example== | ||
This example will show the friction state of each wheel of the player's current vehicle: | |||
This example will show the friction state of each wheel of the player's current vehicle | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler( | addEventHandler("onClientRender", root, function () | ||
local veh = getPedOccupiedVehicle(localPlayer) | local veh = getPedOccupiedVehicle (localPlayer) | ||
if | if not veh then | ||
return false | return false | ||
end | end | ||
dxDrawRectangle(0, 0, 300, 140, tocolor(0, 0, 0, 150)) | dxDrawRectangle (0, 0, 300, 140, tocolor (0, 0, 0, 150)) | ||
dxDrawText( | dxDrawText ("FRICTION FRONT LEFT = ".. getVehicleWheelFrictionState (veh, 0), 8, 10, 290, 40, tocolor (255, 255, 255), 1.5) | ||
dxDrawText( | dxDrawText ("FRICTION FRONT RIGHT = ".. getVehicleWheelFrictionState (veh, 2), 8, 40, 290, 70, tocolor (255, 255, 255), 1.5) | ||
dxDrawText( | dxDrawText ("FRICTION REAR LEFT = ".. getVehicleWheelFrictionState (veh, 1), 8, 70, 290, 100, tocolor (255, 255, 255), 1.5) | ||
dxDrawText( | dxDrawText ("FRICTION REAR RIGHT = ".. getVehicleWheelFrictionState (veh, 3), 8, 100, 290, 130, tocolor (255, 255, 255), 1.5) | ||
end) | |||
</syntaxhighlight> | |||
==Requirements== | |||
{{Requirements|n/a|1.5.8-9.20726|}} | |||
==See Also== | ==See Also== | ||
{{Client vehicle functions}} | {{Client vehicle functions}} |
Latest revision as of 20:39, 23 September 2021
This function returns the current wheel friction state of the vehicle.
Syntax
int getVehicleWheelFrictionState ( vehicle theVehicle, int wheel )
OOP Syntax Help! I don't understand this!
- Method: vehicle:getWheelFrictionState(...)
Required Arguments
- theVehicle: The vehicle that you wish to get the wheel friction state.
- wheel: The wheel you want to check. (0: front left, 1: rear left, 2: front right, 3: rear right)
Returns
Returns a int indicating the wheel friction state. This value can be:
- 0: Normal friction
- 1: Slip with acceleration (only for driving wheels)
- 2: Slip without acceleration
- 3: Locked wheel (on brake or handbrake).
Example
This example will show the friction state of each wheel of the player's current vehicle:
addEventHandler("onClientRender", root, function () local veh = getPedOccupiedVehicle (localPlayer) if not veh then return false end dxDrawRectangle (0, 0, 300, 140, tocolor (0, 0, 0, 150)) dxDrawText ("FRICTION FRONT LEFT = ".. getVehicleWheelFrictionState (veh, 0), 8, 10, 290, 40, tocolor (255, 255, 255), 1.5) dxDrawText ("FRICTION FRONT RIGHT = ".. getVehicleWheelFrictionState (veh, 2), 8, 40, 290, 70, tocolor (255, 255, 255), 1.5) dxDrawText ("FRICTION REAR LEFT = ".. getVehicleWheelFrictionState (veh, 1), 8, 70, 290, 100, tocolor (255, 255, 255), 1.5) dxDrawText ("FRICTION REAR RIGHT = ".. getVehicleWheelFrictionState (veh, 3), 8, 100, 290, 130, tocolor (255, 255, 255), 1.5) end)
Requirements
Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.5.8-9.20726" />
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