GetVehicleWheelFrictionState: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Removed newline)
mNo edit summary
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__
__NOTOC__
{{New feature/item|3.0160|1.5.8|20726|This function returns the current wheel friction state of the [[vehicle]].}}
{{New feature/item|3.0159|1.5.8|20726|This function returns the current wheel friction state of the [[vehicle]].}}


==Syntax==
==Syntax==
Line 20: Line 20:
* '''1:''' Slip with acceleration (only for driving wheels)
* '''1:''' Slip with acceleration (only for driving wheels)
* '''2:''' Slip without acceleration
* '''2:''' Slip without acceleration
* '''3:''' Locked wheel (on brake on handbrake).
* '''3:''' Locked wheel (on brake or handbrake).


==Example==
==Example==

Revision as of 11:33, 11 April 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

Click to collapse [-]
Client

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)

See Also