Closed iSentrie closed 2 months ago
@iSentrie Hi! This method @itsmaty refactored. Do you know about this or has it happened to you? by the way thanks for this research @iSentrie.
We can see that old version had in mind all these things (except when wheels falls off) and properly indexes the wheels.
local numWheels = tostring(GetVehicleNumberOfWheels(vehicle))
local TyresIndex = { -- Wheel index list according to the number of vehicle wheels.
["2"] = { 0, 4 }, -- Bike and cycle.
["3"] = { 0, 1, 4, 5 }, -- Vehicle with 3 wheels (get for wheels because some 3 wheels vehicles have 2 wheels on front and one rear or the reverse).
["4"] = { 0, 1, 4, 5 }, -- Vehicle with 4 wheels.
["6"] = { 0, 1, 2, 3, 4, 5 }, -- Vehicle with 6 wheels.
}
if TyresIndex[numWheels] then
for _, idx in pairs(TyresIndex[numWheels]) do
tyreBurst[tostring(idx)] = IsVehicleTyreBurst(vehicle, idx, false)
end
end
This should be reverted https://github.com/esx-framework/esx_core/commit/a5157bd8d4e08e129d6370089218311522198cff
Hi! @iSentrie Yes, we will revert thanks for help.
fyi. wheel related natives doesn't work properly if the wheel has been deleted with the break wheel native. With recent artifacts update it will even print in F8 that the native is of no use.
And as @iSentrie pointed out, it should 100% be reverted. And u should add compatibility for 8 wheelers as well. They seem to use the same tyreIndex array as 6 wheelers but it needs to be there as the numWheels variable returns 8.
Researched more in to 8 wheelers, I never thought about these.
Missing indexes for 8 wheelers are:
412 and 416
2802
547 / 549
2944
412 / 416
3095
788 / 792
@iSentrie @t1ger-scripts Hi! Thanks for research guys, we will revert last commit(https://github.com/esx-framework/esx_core/commit/a5157bd8d4e08e129d6370089218311522198cff).
Reverted 166907d The change will be available in the next release.
Hey, thanks for noticing and pointing out my mistake. I'm embarrassed and want to apologize, I should have looked closer at the code and what I was changing. I already wondered how somebody imagined this "fucked up logic" for a seemingly so simple task, well it was because the logic wasn´t fucked up.
https://github.com/esx-framework/esx_core/blob/c80916c3e3b14e3cfce6102801b382e59c49bd27/%5Bcore%5D/es_extended/client/functions.lua#L581-L585
Here we can see that we check for
wheel_count
Which could be okay if in GTA vehicles would have wheels consistently from 0 to 3 which is not true in this game, example: Adder, has 4 wheels and
GetVehicleNumberOfWheels
will return 4, howeverIsVehicleTyreBurst
will fail on rear wheels.Adder wheels by
IsVehicleTyreBurst
0 FL (front left) 1 FR (front right) 2 none (by documentation 2 = wheellm / in 6 wheels trailer, plane or jet is first one on left) 3 none_ (by documentation 3 = wheel_rm / in 6 wheels trailer, plane or jet is first one on right) 4 RL 5 RR 6 again FL 7 again RLNow this tells us that no matter what 2 and 3 will always be intact. Example with 1 wheel burst (front left): Example with all wheels burst:
So our current function will always fail.
To test this theory I wrote this simple script
Also we can see more info about native and wheels here https://docs.fivem.net/natives/?_0xEC6A202EE4960385
So in conclusion easiest way is probably to run
for wheel = 0, 7 do
and it will return all wheels intact or burst, because native will return that wheel as intact if that vehicle don't have that specific wheel.However again
We have a feature which breaks off the wheel off the vehicle, which will also return the wheel as intact by
IsVehicleTyreBurst
.Example, the wheel is off, but returns as fine:
To test that I wrote this simple script:
Breaking wheels off working as expect from 0 to 3, as how we would wish for
IsVehicleTyreBurst
too. I haven't found a way to check this, so far triedGetVehicleWheelHealth
,GetVehicleWheelXOffset
andGetVehicleWheelYRotation
, doesn't seem to have any effect is the wheel is on or off.