Exports
Complete client export reference for RB HUD with Lua, TypeScript, and C# examples.
RB HUD exposes 20 client exports. Call them only from client scripts after
rb_hud has started. There are currently no server exports.
The resource must be named
rb_hud. Every example below uses that exact resource name.
Complete language examples
Each tab calls every available export. In normal code, call only the methods needed for your integration.
local hud = exports.rb_hud
hud:initHud()
hud:hidePlayerHud()
hud:showPlayerHud()
hud:hideHud()
hud:setOxygen(75)
hud:hideHudExceptVoice()
hud:showHud()
hud:editMode()
hud:changeMapMode('Only in Vehicle')
hud:changeCompassMode('Always On')
hud:changeCompassStyle('Bar')
hud:refreshMapDisplay()
hud:showMapDisplay(true)
hud:hideMapDisplay()
hud:setMapHudHidden(true)
local mapHidden = hud:isMapHudHidden()
local anchor = hud:getMinimapAnchor()
hud:showCompassDisplay()
hud:hideCompassDisplay()
hud:toggleCinematic(true)type HudDisplayMode = "Only in Vehicle" | "Always On" | "Always Off";
type CompassStyle = "Default" | "Bar";
interface MinimapAnchor {
x: number;
y: number;
LeftX: number;
TopY: number;
RightX: number;
BottomY: number;
CenterX: number;
CenterY: number;
Width: number;
Height: number;
}
interface RbHudExports {
initHud(): void;
hidePlayerHud(): void;
showPlayerHud(): void;
hideHud(): void;
setOxygen(value: number): void;
hideHudExceptVoice(): void;
showHud(): void;
editMode(): void;
changeMapMode(mode: HudDisplayMode): void;
changeCompassMode(mode: HudDisplayMode): void;
changeCompassStyle(style: CompassStyle): void;
refreshMapDisplay(): void;
showMapDisplay(load?: boolean): void;
hideMapDisplay(): void;
setMapHudHidden(hidden: boolean): void;
isMapHudHidden(): boolean;
getMinimapAnchor(): MinimapAnchor | null;
showCompassDisplay(): void;
hideCompassDisplay(): void;
toggleCinematic(enabled: boolean): void;
}
const hud = exports["rb_hud"] as RbHudExports;
hud.initHud();
hud.hidePlayerHud();
hud.showPlayerHud();
hud.hideHud();
hud.setOxygen(75);
hud.hideHudExceptVoice();
hud.showHud();
hud.editMode();
hud.changeMapMode("Only in Vehicle");
hud.changeCompassMode("Always On");
hud.changeCompassStyle("Bar");
hud.refreshMapDisplay();
hud.showMapDisplay(true);
hud.hideMapDisplay();
hud.setMapHudHidden(true);
const mapHidden = hud.isMapHudHidden();
const anchor = hud.getMinimapAnchor();
hud.showCompassDisplay();
hud.hideCompassDisplay();
hud.toggleCinematic(true);These calls belong inside a class derived from BaseScript, where the FiveM
Exports property is available.
dynamic hud = Exports["rb_hud"];
hud.initHud();
hud.hidePlayerHud();
hud.showPlayerHud();
hud.hideHud();
hud.setOxygen(75);
hud.hideHudExceptVoice();
hud.showHud();
hud.editMode();
hud.changeMapMode("Only in Vehicle");
hud.changeCompassMode("Always On");
hud.changeCompassStyle("Bar");
hud.refreshMapDisplay();
hud.showMapDisplay(true);
hud.hideMapDisplay();
hud.setMapHudHidden(true);
bool mapHidden = (bool)hud.isMapHudHidden();
dynamic anchor = hud.getMinimapAnchor();
hud.showCompassDisplay();
hud.hideCompassDisplay();
hud.toggleCinematic(true);Full HUD and lifecycle
| Export | Parameters | Returns | Behavior |
|---|---|---|---|
initHud | None | Nothing | Initializes player HUD state and starts its update loop. RB HUD normally calls this automatically after the framework reports a loaded player. |
hideHud | None | Nothing | Hides player, vehicle, compass, and minimap elements and keeps the minimap suppressed across normal refreshes. |
hideHudExceptVoice | None | Nothing | Hides the HUD while retaining the voice/microphone indicator, useful for death or knockout flows. |
showHud | None | Nothing | Re-enables the HUD. Map and compass visibility still follows the player's selected display modes. |
toggleCinematic | enabled: boolean | Nothing | Shows or hides the cinematic bars and inversely hides or restores HUD elements. |
Cinematic mode
exports.rb_hud:toggleCinematic(true)
-- Later
exports.rb_hud:toggleCinematic(false)exports["rb_hud"].toggleCinematic(true);
// Later
exports["rb_hud"].toggleCinematic(false);Exports["rb_hud"].toggleCinematic(true);
// Later
Exports["rb_hud"].toggleCinematic(false);Player HUD
| Export | Parameters | Returns | Behavior |
|---|---|---|---|
hidePlayerHud | None | Nothing | Hides only the player status HUD. |
showPlayerHud | None | Nothing | Shows only the player status HUD. |
setOxygen | value: number | Nothing | Updates the diving-oxygen indicator. The displayed value is clamped to 0–100. |
setOxygen is intended for diving gear or other resources that maintain an
oxygen value independently of GTA's normal underwater timer.
exports.rb_hud:setOxygen(65)exports["rb_hud"].setOxygen(65);Exports["rb_hud"].setOxygen(65);Editor and saved preferences
| Export | Parameters | Returns | Behavior |
|---|---|---|---|
editMode | None | Nothing | Opens HUD Studio and enables cursor focus. Complete named profiles persist in the player's versioned rb_hud_profiles KVP. |
changeMapMode | mode: string | Nothing | Persists and applies Only in Vehicle, Always On, or Always Off. |
changeCompassMode | mode: string | Nothing | Persists and applies Only in Vehicle, Always On, or Always Off. |
changeCompassStyle | style: string | Nothing | Persists and applies Default or Bar. |
Pass the strings exactly as shown, including capitalization and spaces.
exports.rb_hud:changeMapMode('Always On')
exports.rb_hud:changeCompassMode('Only in Vehicle')
exports.rb_hud:changeCompassStyle('Bar')exports["rb_hud"].changeMapMode("Always On");
exports["rb_hud"].changeCompassMode("Only in Vehicle");
exports["rb_hud"].changeCompassStyle("Bar");Exports["rb_hud"].changeMapMode("Always On");
Exports["rb_hud"].changeCompassMode("Only in Vehicle");
Exports["rb_hud"].changeCompassStyle("Bar");Minimap
| Export | Parameters | Returns | Behavior |
|---|---|---|---|
refreshMapDisplay | None | Nothing | Re-evaluates minimap visibility from the manual-hidden state, saved mode, and current vehicle. |
showMapDisplay | load?: boolean | Nothing | Refreshes the minimap. With true, waits for the session, recalculates saved offsets, and initializes it first. It still respects the saved map mode. |
hideMapDisplay | None | Nothing | Immediately hides the minimap. A later automatic refresh can show it again. |
setMapHudHidden | hidden: boolean | Nothing | Changes the manual-hidden flag. Call refreshMapDisplay or hideMapDisplay afterward to redraw immediately. |
isMapHudHidden | None | Boolean | Returns the manual-hidden flag. This is not necessarily the current radar visibility. |
getMinimapAnchor | None | Table/object or null | Returns normalized screen bounds after minimap initialization, otherwise nil/null. |
Use setMapHudHidden(true) plus hideMapDisplay() when another UI needs the
map to stay hidden. Restore it with setMapHudHidden(false) followed by
refreshMapDisplay().
Minimap anchor shape
| Field | Meaning |
|---|---|
x, LeftX | Left edge in normalized screen coordinates. |
y, TopY | Top edge in normalized screen coordinates. |
RightX, BottomY | Right and bottom edges. |
CenterX, CenterY | Center point. |
Width, Height | Normalized minimap dimensions. |
Compass
| Export | Parameters | Returns | Behavior |
|---|---|---|---|
showCompassDisplay | None | Nothing | Starts/continues compass updates and shows it only when the saved compass mode allows it. |
hideCompassDisplay | None | Nothing | Hides the compass and stops its update loop. |
The Bar style also displays nearby map blips and updates more frequently than
the default directional compass.