The native DoesVehicleTyreExist does not work at all… It always returns false.
I used the following code to test this out as a client sided script:
-- Define wheel bones and indices
local tireBones = {"wheel_lf", "wheel_rf", "wheel_lm", "wheel_rm", "wheel_lr", "wheel_rr"}
local tireIndices = {
["wheel_lf"] = 0,
["wheel_rf"] = 1,
["wheel_lm"] = 2,
["wheel_rm"] = 3,
["wheel_lr"] = 4,
["wheel_rr"] = 5,
}
-- Register a key mapping for the E key
RegisterCommand('checkVehicleWheels', function()
-- Get the player's vehicle
local playerPed = PlayerPedId()
local vehicle = GetVehiclePedIsIn(playerPed, false)
if vehicle and vehicle ~= 0 then
print("Checking vehicle wheels...")
for _, bone in ipairs(tireBones) do
local index = tireIndices[bone]
if index then
-- Check if the tire exists
if DoesVehicleTyreExist(vehicle, index) then
print(string.format("Tire '%s' (Index: %d) exists.", bone, index))
else
print(string.format("Tire '%s' (Index: %d) is missing.", bone, index))
end
end
end
else
print("Player is not in a vehicle.")
end
end, false)
-- Bind the E key to the command
RegisterKeyMapping('checkVehicleWheels', 'Check Vehicle Wheels', 'keyboard', 'E')
