GIG ScriptsGIG Scripts

HUD

Player, vehicle, minimap and info HUD with a per-player settings menu.

Dependencies

  • ox_lib
  • oxmysql
  • Qbox, QB-Core or ESX. Without a framework the HUD still runs, but money, job and needs show defaults.
server.cfg
ensure gig-hud

Items

Both items are optional. Leave the config key at false if you do not want them.

ItemUsed byConfig key
harnessracing harness, keeps you in the seat above the belt speed limitcfg.harness.itemName
nitrousrefills the nitro tank, consumed on usecfg.nitro.refillItem

The harness is checked, never consumed. Add both to your inventory as usable items:

ox_inventory/data/items.lua
['harness'] = {
    label = 'Racing Harness',
    weight = 1000,
    stack = false,
    close = true,
},
['nitrous'] = {
    label = 'Nitrous',
    weight = 2000,
    stack = true,
    close = true,
},
qb-core/shared/items.lua
['harness'] = { name = 'harness', label = 'Racing Harness', weight = 1000, type = 'item', image = 'harness.png', unique = true, useable = true, shouldClose = true, description = 'Keeps you in the seat.' },
['nitrous'] = { name = 'nitrous', label = 'Nitrous', weight = 2000, type = 'item', image = 'nitrous.png', unique = false, useable = true, shouldClose = true, description = 'Refills the nitro tank.' },

Commands and keys

CommandDefault keyWhat it does
/hudF7opens the settings menu
/cinematicF10toggles letterbox bars
/seatbeltKbuckle / unbuckle
/cruise [kmh]Lspeed limiter
/harnessnoneequip / remove the harness
/anchorXdrop / raise the boat anchor
nitroleft Alt (hold)boost

Keys are defaults. Players change them in the GTA keybind settings under FiveM.

Config

cfg.lua is long because the HUD has a lot of switches. The parts worth knowing:

  • cfg.serverName and cfg.logo fill the info panel. The logo accepts an nui:// path or an https URL.
  • cfg.defaults holds the default value of every menu option. Set hide = true on a category to remove its tab and switch that part of the HUD off for everyone, or on a single option to force its value and remove the row. Forced values win over whatever a player saved earlier. Players override the rest from the menu and their choices are saved per character.
  • cfg.seatbelt.provider is builtin by default: the HUD's own belt, usable from any seat. Set it to external when another script handles seatbelts; that script either sets LocalPlayer.state.seatbelt (the key is cfg.seatbelt.stateKey) or calls the setSeatbelt export, and the HUD icon, the crash ejection and the harness logic follow it.
  • cfg.eject throws unbuckled players through the windscreen on a hard crash. cfg.stressEffect blurs the screen at stress thresholds.
  • cfg.nitro is a complete example nitro system. Turn it off if you use another one; the nitro gauge still works through the export below.
  • cfg.electricVehicles lists models that show a battery instead of fuel.
  • cfg.radar locks the minimap zoom and disables the big map.

Exports

Client side:

exports['gig-hud']:toggleHud(state)       -- show or hide the whole HUD
exports['gig-hud']:setCinematic(state)
exports['gig-hud']:setSeatbelt(state)     -- also getSeatbelt(), setHarness(), getHarness()
exports['gig-hud']:setStatusCell(id, value)   -- update a custom status cell (see cfg.customCells)
exports['gig-hud']:setVehicleCell(id, value)
exports['gig-hud']:setInfoCell(id, text, label)
exports['gig-hud']:set3DGpsState(state)   -- 3D GPS route on/off

Server side:

exports['gig-hud']:getSettings(src) -- the player's saved settings table

Notes

  • The nitro gauge reads a state bag. If you use an external nitro script, write Entity(vehicle).state.nitro (0 to 100) and the gauge follows.
  • Odometer support for jg-vehiclemileage is behind cfg.jgMileage.
  • The voice indicator detects pma-voice and SaltyChat. Force one with cfg.voiceProvider if detection picks the wrong one.

On this page