I’m developing a speedometer (see below screenshot), I thought there was a native to get vehicle engine RPM, but no it doesn’t exist.
I then found that you should read the value directly in RAM, like ScriptHookDotNet (https://github.com/crosire/scripthookvdotnet/blob/dev_v3/source/scripting/Vehicle.cs#L775).
I haven’t found a way to do the same thing in lua, does anyone have a clue ?
hello , i did few gauge for the car aswell , and i got the same problem then you. with the CitizenFX.dll they made a function for getting the RPM but unfortunatly this one is not working (at least for me) , i hope they gonna fix it if they have the time for.
I suspected the solution would not be in LUA … I had hoped someone knew how to access the RAM in lua to reproduce the ScriptHook .NET function … Now hope someone can fix the CitizenFX.dll function
I think you did not quite understand my problem (or I misunderstood your answer). I get to get the vehicle speed (the right gauge) with the GetEntitySpeed function in LUA and convert it to mph or km/h. I am trying to get the RPM of the engine (the left gauge) and optionally the vehicle current gear.
we are not try to get the speed of the car but the RPM , unfortunatly the RPM is not directly linked with the movement of a car and plus every car got different kind of engine and torque so your idea is not working
As you can see in this commit the offsets were corrected for the game version FiveM uses.
In fact, Vehicle.CurrentRPM works just fine, as you can see in the following video. (It returns a float between 0 and 1) https://streamable.com/c3y33
a float between 0-1 omg i’m so stupid , i even didn’t check the return ,i execpted a return with the true value lol , thanks man , u make my day i’m gonna fix it directly