Skip to content

Conversation

@Xenius97
Copy link
Contributor

@Xenius97 Xenius97 commented Nov 12, 2025

Closes #3955

This PR fixes an issue where getVehicleWheelFrictionState throws an "Invalid vehicle type" error when used on non-"Automobile" vehicles such as bikes, monster trucks, and quads.

Previously, this function was only usable on cars, which limited its usefulness for detecting vehicle behavior. With this change, the function now supports bikes, bicycles, quad and monster truck

Nevtelen.video.A.Clipchamppel.keszult.mp4

Test code:

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))
	if getVehicleType(veh) == "Bike" or getVehicleType (veh) == "BMX" then
		dxDrawText("FRICTION FRONT = ".. getVehicleWheelFrictionState (veh, 0), 8, 10, 290, 40, tocolor (255, 255, 255), 1.5)
		dxDrawText("FRICTION REAR = ".. getVehicleWheelFrictionState (veh, 1), 8, 40, 290, 70, tocolor (255, 255, 255), 1.5)
	else
		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
end)

@FileEX FileEX added the enhancement New feature or request label Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getVehicleWheelFrictionState not working on bikes

3 participants