[RELEASE] Forza Horizon 4 Speedometer

Good day @Akkariin,

I have noticed that the script still runs when the player is not in a vehicle.
Screenshot_39

Code to resolve the issue.
Citizen.CreateThread(function()
	while true do
		Wait(1)
		playerPed = GetPlayerPed(-1)
		if IsPedInAnyVehicle(playerPed) then
		
			if playerPed and not isHide then
				
				playerCar = GetVehiclePedIsIn(playerPed, false)
				
				if playerCar and GetPedInVehicleSeat(playerCar, -1) == playerPed then
					
					carRPM                    = GetVehicleCurrentRpm(playerCar)
					carSpeed                  = GetEntitySpeed(playerCar)
					carGear                   = GetVehicleCurrentGear(playerCar)
					carIL                     = GetVehicleIndicatorLights(playerCar)
					carHandbrake              = GetVehicleHandbrake(playerCar)
					carBrakePressure          = GetVehicleWheelBrakePressure(playerCar, 0)
					carLS_r, carLS_o, carLS_h = GetVehicleLightsState(playerCar)
					
					SendNUIMessage({
						ShowHud             = true,
						CurrentCarRPM       = carRPM,
						CurrentCarGear      = carGear,
						CurrentCarSpeed     = carSpeed,
						CurrentCarKmh       = math.ceil(carSpeed * 3.6),
						CurrentCarMph       = math.ceil(carSpeed * 2.236936),
						CurrentCarIL        = carIL,
						CurrentCarHandbrake = carHandbrake,
						CurrentCarBrake     = carBrakePressure,
						CurrentCarLS_r      = carLS_r,
						CurrentCarLS_o      = carLS_o,
						CurrentCarLS_h      = carLS_h,
						PlayerID            = GetPlayerServerId(GetPlayerIndex())
					})
					
				else
					SendNUIMessage({HideHud = true})
				end
			end
		end
	end
end)

After adding a simple if statement to determine if the player is in a vehicle the scripts runtime decreases.
Screenshot_40

I already made a pull request on the you’re Github.

Have a nice day!

Thanks, I uploaded the new code, now it only take 0.01ms and 0.26% CPU time.

Hello,

I have noticed a small error i had made. After the UI is displayed on the screen it does not remove the UI once a player is out of a vehicle. I resolved this by placing else and sending a NUI message to hide the HUD.

I went ahead and pushed another request through Github.

Thank you,

1NF1N17Y#5646

Thanks, I updated the code manually because there have some conflicts that need to be resolved

1 Like

I realized a mistake i made once uploaded it, i saw you did the same to fix the issue by simply adding a wait.

Anyways love the work you have done!

Hi guys, I am running this on local fiveM server and it is shuttering for me for some reason, I do not know why, other speedometers that I have tried worked fine.

Add

  • Fuel
  • Engine
  • Hide Speedometer when open phone

thank you :relaxed: Pls.

1 Like

Hello, here is a small modification that I made to the script. (All rights to the owners, I just modified several things and wanted to share it with you in case someone likes it @Akkariin )

  • Size minimized by 50%

  • Added SPORT + option (changes color according to the car’s gear, green, orange and red)

  • Remove HBK and add a stop emoji (lights up when you brake with the space bar)

I leave several images:

-Car stopped in R (GREEN):

20210512030309_1

-Car in normal speed (ORANGE):

20210512030233_1

-Car with high gear (RED):

20210512030302_1

-Car braking with space bar:

20210512031609_1

-Here is the download link from MEGA:

DOWNLOAD LINK

Thank you and I hope you like it. Leave your criticisms and answers, I will answer you and read delighted! Greetings, Rauw!

7 Likes

it said outdated manifest… how?

Can you increase the fuel status of the car?

no longer available the link

same with me, i have blurry rpm aswell

Yeah I stopped using this speedometer.
It’s my favorite as I love FH. But it just keeps lagging.

Try the 1.0 Version. It is not laggy at all.

Go and get a updated manifest from FiveM or a GitHub link or another resource. Then copy and paste the stuff into the __resource.lua and make sure it matches with the files inside of the fhspeedometer :slight_smile:

I Do not rember

you switch the wording by going to HTML/Hud and then change

KMH
to
MPH

can you reupload the link pls

anyone know to add fuel system to this ?