altmp / coreclr-module

CoreClr (.NET Core Common Language Runtime) community made module
MIT License
15 stars 7 forks source link

GetVehicleMaxBraking native not working on some vehicles #6

Closed TuK4z closed 5 months ago

TuK4z commented 6 months ago

I tried JS and c#, so error exists only in c# module. If use GetVehicleMaxBraking Native on some vehicles it throws and error image

Reproduce: float braking = Alt.Natives.GetVehicleMaxBraking(Alt.Hash("Chino")); Alt.Log($"Chino braking: {braking}");

Doxoh commented 5 months ago

u need to set the vehicle entity as parameter

TuK4z commented 5 months ago

That is strange, because in JS you can add model name and it's working.

Also with model working other natives like GetVehicleModelMaxTraction and GetVehicleModelAcceleration So if i send to UI info, i do't have created vehicle that's why with model name it was better.

Doxoh commented 5 months ago

GetVehicleModelMaxTraction and GetVehicleModelAcceleration accept hashes

image image

but GetVehicleMaxBraking not image

Doxoh commented 5 months ago

Also JS only accept vehicle or vehicleId image

TuK4z commented 5 months ago

Ok maybe i was mistaken, i wont use it for now. In JS my code was:

for (let i = 0; i < data.length; i++) {
    const modHash = alt.hash(data[i].Model);
    data[i].Speed = (native.getVehicleModelEstimatedMaxSpeed(modHash) * 3.6).toFixed(0);
    data[i].Acceleration = native.getVehicleModelAcceleration(modHash).toFixed(2);
    data[i].Braking = native.getVehicleModelMaxBraking(modHash).toFixed(2);
    data[i].Traction = native.getVehicleModelMaxTraction(modHash).toFixed(2);
    //console.log("Breaking: " + data[i].Braking + " Traction: " + data[i].Traction)
}

now after migrating to C# that native stoped working.