altv-issues icon indicating copy to clipboard operation
altv-issues copied to clipboard

Handling API broken

Open Konders opened this issue 10 months ago • 8 comments

Description of the problem

Handling api completely broken some main fields by 'broken' i mean that handling API doesn't change vehicle behaviour, because if we just change handling.meta and restart the game - this fields working correctly

Here is a list of fields, and range of values that we tested on many vehicles

driveInertia: 0.01 - 2
driveMaxFlatVel: 1 - 100
initialDragCoeff: 10 - 120
initialDriveForce: 0.1 - 1.9
initialDriveGears: 1 - 8
initialDriveMaxFlatVel: 1 - 100

Reproduction steps

clientside: vehicle.handling.driveInertia = 0.05

Expected behaviour

Expected changes in vehicle behaviour

Additional context

I think this is should be not critical priority, but really high Because there is many issues about that, and we(server developers) cant implement tuning features that we want, so we are blocked atm

Operating system

Windows 11

Version

release/16.0.152

Crashdump ID

No response

Confirmation of issue's presence

  • [X] By submitting this ticket, I affirm that I have verified the presence of this issue on the latest developer version available at the time of writing this ticket.

Konders avatar Apr 15 '24 09:04 Konders

That are Initial Values, you need to change them in General handling the vehicle needs this value on Spawn time (client side creation) later there are not change able

access them via alt.HandlingData.getForHandlingName and change before the spawn.

BluePeer avatar Apr 15 '24 10:04 BluePeer

There are not only initial values; is there any way to implement correct setters after a vehicle spawns for those fields? It would open up a significant number of possibilities for tuning.

Because it's not possible to synchronize by any means right now, if we change the handling for a model before it streams, we can end up in a situation where there might be a car meet with 50 cars (even with the same model), and we can't synchronize them correctly.

Konders avatar Apr 15 '24 10:04 Konders

I don't think that comparing to other multiplayers is a good idea, but for a Proof of Concept, it should be sufficient. So, in one multiplayer, people set initial values on a specific vehicle after its spawn. For example:

SetVehicleHandlingInt(vehicle, "CCarHandlingData", "strAdvancedFlags", value.strAdvancedFlags)
SetVehicleHandlingFloat(vehicle, "CHandlingData", "fInitialDriveMaxFlatVel", value.fInitialDriveMaxFlatVel + 0.0)
SetVehicleHandlingFloat(vehicle, "CHandlingData", "fInitialDriveForce", value.fInitialDriveForce + 0.0)
SetVehicleHandlingFloat(vehicle, "CHandlingData", "fDriveInertia", value.fDriveInertia + 0.0)
SetVehicleHandlingInt(vehicle, "CHandlingData", "nInitialDriveGears", value.nInitialDriveGears)

Konders avatar Apr 15 '24 11:04 Konders

After you make changes to the above handling values, utilize "ModifyVehicleTopSpeed(veh, 1)" and that should kick them into effect. Pretty sure this issue is GTAV being weird itself. But that native seems to cause them to work throughout my experiences.

TrashaPanda avatar Jun 29 '24 12:06 TrashaPanda

After you make changes to the above handling values, utilize "ModifyVehicleTopSpeed(veh, 1)" and that should kick them into effect. Pretty sure this issue is GTAV being weird itself. But that native seems to cause them to work throughout my experiences.

Tnx for your reply, i will try your advice. Idk about the issue itself is in GTAV, as i knew in other GTAV mp's this features are working out of the box without such issues with *initial props.

gotgameio avatar Jun 29 '24 12:06 gotgameio

In fivem you NEED to use that native for the values to update after a car is spawned. Thats why i know about the issue and believe it to be gtav related.

TrashaPanda avatar Jun 29 '24 12:06 TrashaPanda

In fivem you NEED to use that native for the values to update after a car is spawned. Thats why i know about the issue and believe it to be gtav related.

Dont get me wrong, for FiveM i was only reading docs and didnt checked my self, in Rage i was checked myself everything was fine few years ago. As i know in altV this issue is related to streaming, i can be wrong. I will try your suggestion and i hope this will help with initial* properties.

gotgameio avatar Jun 29 '24 12:06 gotgameio

Alt.Natives.ModifyVehicleTopSpeed(vehicle, 1); <--- add this after all your handling adjustments.

profit.

have a nice day.

https://discord.com/channels/371265202378899476/576771706119520287/1258460157927755899 proofs (assuming ur in AltV disco)

TrashaPanda avatar Jul 04 '24 16:07 TrashaPanda

@Konders @xxshady

As TrashaPanda said, by calling alt.Player.local.vehicle.setupTransmission() or native.modifyVehicleTopSpeed(vehicle.scriptID, 1) after your handling calls, the values will affected on vehicle.

Using native.modifyVehicleTopSpeed is a common way on FiveM. Take a look at this.

I think it's a good time to close this issue.

alt.Player.local.vehicle.handling.initialDriveGears = 1;
alt.Player.local.vehicle.handling.initialDriveMaxFlatVel = 1000;
alt.Player.local.vehicle.setupTransmission();

mrgharabaghi avatar Sep 04 '24 03:09 mrgharabaghi