[RELEASE] Forza Horizon 4 Speedometer

Size can be edited in the hud.css file

1 Like

My design on the server

1 Like

Do you share it?

No, never in my life.

changing the properties of #container does nothing.

EDIT: decided to resize each div style to fit my needs. Really couldn’t figure out why the parent style does nothing. :man_shrugging:

hud.html i changed under canvas UNITDISPLAY to MPH from KMH and it worked for me hope this helps.

1 Like

this is due to everything having its own size/right.

I easily resized it by using this

#container {
    display: none;
    zoom: 0.5;
    -moz-transform: scale(0.5);
}
1 Like

fh4speed-1.0.rar (249.6 KB) This will make it so the speedometer is in MPH and Read MPH

2 Likes

Yes it works good job

Is there a way to use this in standard single player?

1 Like

is there a way i can change it from khm to mph

Love u so much dude, i tried so long! :wink:
Is there a way to put the whole thing in the middle bottom of the screen?

1 Like

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.