fivem icon indicating copy to clipboard operation
fivem copied to clipboard

[Handling] Many values are not properly applied when using the handling vehicle natives.

Open ImBaphomettt opened this issue 9 months ago • 6 comments

What happened?

Hello! :wave:

It’s possible that this is due to a misuse on my part, as no one else seems to have reported this issue. If that’s the case, I sincerely apologize in advance. However, based on my research, I truly believe this is an issue with the native itself.

I'm trying to set the strModelFlags value using the appropriate native, SetVehicleHandlingInt. Here is the reference:

SetVehicleHandlingInt -> https://github.com/citizenfx/fivem/blob/ad6c90072e62cdb7ee0dcc943d7ded8a5107d542/code/components/handling-loader-five/src/HandlingLoader.cpp#L135

However, this doesn't seem to have any effect on the vehicle.

For example, I'm trying to apply the MF_NO_WHEEL_BURST flag (1 << 25, which equals 2000000) (https://adam10603.github.io/GTA5VehicleFlagTool/) using the following:`

SetVehicleHandlingInt(iEntityID, 'CHandlingData', 'strModelFlags', 2000000)

When I retrieve the value with:

GetVehicleHandlingInt(iEntityID, 'CHandlingData', 'strModelFlags')

It correctly returns 2000000, so the value appears to be set. However, there’s no observable effect the tires are not bulletproof.

is it a known limitation or issue ?

I’ve also observed this issue with several handling parameters. For example, fMass cannot be set to a value higher than the one defined in the .meta files (this is a theory based on my research).

Similarly, nInitialDriveGears doesn’t seem to correctly increase the number of forward gears in the vehicle’s transmission.

Expected result

The values set through these natives should be properly applied and should effectively modify the corresponding handling parameters in-game.

Reproduction steps

Here are a few example videos demonstrating the nInitialDriveGears parameter. They provide a more visual and straightforward understanding of the issue.

Steps to Reproduce:

Spawn a random vehicle (e.g., Sultan).

While the player is inside the vehicle, execute the following code:

(max 7 ? why) https://github.com/citizenfx/fivem/blob/ad6c90072e62cdb7ee0dcc943d7ded8a5107d542/code/components/handling-loader-five/src/HandlingLoader.cpp#L152)

SetVehicleHandlingInt(GetVehiclePedIsIn(PlayerPedId(), false), 'CHandlingData', 'nInitialDriveGears', 7)

Confirm that the value has been updated:

GetVehicleHandlingInt(GetVehiclePedIsIn(PlayerPedId(), false), 'CHandlingData', 'nInitialDriveGears')
-- Returns: 7 (as expected)

However, when checking the vehicle’s current gear using:

GetVehicleCurrentGear(GetVehiclePedIsIn(PlayerPedId(), false))

You will observe that no change occurs in the actual gear behavior, and the vehicle's transmission still behaves as if the gear count has not been modified.

Observations: The parameter appears to update successfully via SetVehicleHandlingInt, but it does not affect the real-time transmission behavior of the vehicle.

This suggests that nInitialDriveGears is either not dynamically applied at runtime or overridden by values in the .meta files.

Video Evidence: https://streamable.com/4j4h3f

Importancy

Slight inconvenience

Area(s)

FiveM

Specific version(s)

FiveM b3095 (Canary)

Additional information

No response

ImBaphomettt avatar Mar 28 '25 18:03 ImBaphomettt

Seems to be a whole lot wrong; looks like the last change in this file (3 years ago) broke this completely. it appears the offsets are incorrect however i know this is being looked in to already or is on someones todo list!

Lorenc95 avatar Mar 31 '25 04:03 Lorenc95

Seems to be a whole lot wrong; looks like the last change in this file (3 years ago) broke this completely. it appears the offsets are incorrect however i know this is being looked in to already or is on someones todo list!

I reported this issue to @tens0rfl0w, who informed me that no one had ever raised it before. They invited me to open an issue so it can be addressed as efficiently and effectively as possible. Let’s hope tensbub 👀 takes a close look at it!

ImBaphomettt avatar Mar 31 '25 16:03 ImBaphomettt

Yeah i am aware hehe, he was checking it late last night and was like "Oh sheesh it appears to be not working correctly on any build.." i'll take a look at it soon 👀

i was going to do some checking myself aswell, however i believe this is better in the hands of someone with more experience!

Lorenc95 avatar Mar 31 '25 19:03 Lorenc95

I'm gonna take a look, at least for my tests the nInitialDriveGears are only updated when spawning the car, so I guess the other one is related.

DaniGP17 avatar Mar 31 '25 20:03 DaniGP17

yeah i figured; i informed tensor about this that for some of the changes with vehicles it does not directly apply if you are 'in the vehicle' while it was updated or so; for example modify a handling.meta and restart it; wont affect until u re-enter the vehicle.

Lorenc95 avatar Apr 01 '25 07:04 Lorenc95

For my test, the strModelFlags only working when you are using SetHandlingInt, and you have to set it before you spawn the vehicle. Here is a simple script to set the handling flags:

https://gist.github.com/kasuganosoras/bc51721474c826786da796e71762d287

kasuganosoras avatar May 15 '25 10:05 kasuganosoras