-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when using SetVehicleHandling natives with value of 0 #3130
Comments
The PR(#3101) that was merged was to avoid null values but the original issue was not for sending null values, because this |
fivem/code/components/handling-loader-five/src/HandlingLoader.cpp Lines 215 to 218 in 7bcb23d
If the handling of fTractionCurveMax is 0.0 it assign a high value, so I'm sure that this is the reason to have strange physics. |
I thought so as I didn't see any difference when using 0 or null as a value; either way, the commit should be reverted & the native shouldn't be validated against null values. |
Oh great find! I didn't notice that, yeah that is likely the cause of the strange physics. |
I'm not sure whether to open a PR to revert the previous changes or wait for someone from CFX to revert the commit. Still, I think it's easier to accept null values because as we know they are converted to 0. And the function that does force arguments to be sent seems to take 0.0 as null. |
Yeah agreed. When I wake up tomorrow I'll probably just submit a PR to revert the commit with a bit of an explanation. |
What happened?
The recent merge of PR #3101 stemming from the issue #3097 now prevents the use of
0
/0.0
as a valid handling value.From what I can tell from a look into the codebase and some basic knowledge of C++, the game sees
0
the same asnil
and it functionally acts the same from my testing too. I can usenil
(in Lua) or0
interchangeably and get the same results. I understand the original issue's point, I suppose for some handling valuesnil
or0
can break the physics of the vehicle, but ultimately a lot of different values can completely screw up vehicles to the point where they cannot be fixed.A float value of
0.0
is valid for various different handling values, and is the default value of many, such asfSuspensionRaise
. An int value of0
is commonly used for signifying no flags, such as forstrAdvancedFlags
. These also work fine and don't break the vehicle when run in-game.TL;DR: Using
SetVehicleHandlingFloat
with a value (arg index 3) of0.0
, the game now sees as invalid even though it should be valid. Same happens when runningSetVehicleHandlingInt
with a value of0
, it throws the same error.Expected result
Using SetVehicleHandlingFloat with a value of 0.0 should run without an error.
Reproduction steps
The following code, attempting to 'reset'
fSuspensionRaise
back to 0.0:Returns the following error, saying arg 3 is nil:
![Image](https://private-user-images.githubusercontent.com/3826279/409863878-b32c2d12-fc26-457c-bee4-9309373473a0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjkxMzQsIm5iZiI6MTczOTM2ODgzNCwicGF0aCI6Ii8zODI2Mjc5LzQwOTg2Mzg3OC1iMzJjMmQxMi1mYzI2LTQ1N2MtYmVlNC05MzA5MzczNDczYTAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTJUMTQwMDM0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODE5ZjU2MDY0YjFjODY5NjVhZmE1NTQ2MmY1MTU1MTRjYjc2ODg3YjVlYjBhMmY5ZTQ4ZTZmZjZlZmM2NDlhOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.8w02TPXhwA-jL-bYezRvWH6MFSzuv--xjb64QOYwjqE)
Here's an example repro for
strAdvancedFlags
, setting a value of0
to signify no advanced flags should be placed on the vehicle. The error returned is the essentially the same as the above.Importancy
Crash
Area(s)
Natives, FiveM
Specific version(s)
FiveM Client 12746 (Currently canary only)
Additional information
No response
The text was updated successfully, but these errors were encountered: