A FiveM client resource that shows a bottom-center HUD with vehicle speed and RPM while the player is seated in a vehicle.
- Appears automatically when you enter a vehicle.
- Hides when you leave a vehicle or open the pause menu.
- Updates about 20 times per second while driving.
- Shows speed as a rounded integer and RPM as a colored arc (green → yellow → orange → red).
- Turns the speed number red when RPM is at 90% or higher (redline).
- Can slide up so it does not sit on top of GTA mission subtitles.
Ensure the resource in server.cfg:
ensure speedometerIt is client-only. There is no server script and no commands.
Edit the constants at the top of client.lua:
| Constant | Default | Purpose |
|---|---|---|
SPEED_MULTIPLIER |
3.6 |
Converts native m/s to km/h. Use 2.236936 for mph. |
SPEED_LABEL |
'KM/H' |
Unit text under the speed. Change to 'MPH' if you switch the multiplier. |
UPDATE_INTERVAL |
50 |
Milliseconds between HUD updates while in a vehicle. |
IDLE_INTERVAL |
500 |
Milliseconds between occupancy checks while on foot. |
Position, size, colors, and the raised offset live in html/style.css:
#speedometer— default placement (bottom: 3vh,width: 180px).#speedometer.raised— how far it moves for mission text (-5vh).transition— fade (0.25s) and raise (0.35s ease-out).#speedometer.redline #speed— redline number color.
Other client scripts can raise or lower the HUD so it clears subtitle / objective text.
-- Slide the speedometer up (smooth CSS transition)
TriggerEvent("speedometer:MissionTextActive")
-- Return it to the default position
TriggerEvent("speedometer:MissionTextInactive")These are client events. Call them from a client script (for example when you start or clear BeginTextCommandPrint objective text). Duplicate calls are ignored.
If this resource restarts while mission text is still on screen, the other resource should fire speedometer:MissionTextActive again after start. The tutorial resource does this on onClientResourceStart.
client.lua talks to the HTML HUD with:
action |
Effect |
|---|---|
update |
Show HUD; set speed, rpm (0–1), and unit. |
hide |
Fade the HUD out. |
missionText |
Toggle the raised position (active true/false). |
You normally do not send these yourself. Use the events above instead.
speedometer/
fxmanifest.lua
client.lua
preview.png
html/
index.html
style.css
script.js
