Integrate mini-games into your FiveM server.
Download zh_minigame from the repository, place the folder anywhere in your server's resources directory, then add to server.cfg:
ensure zh_minigame
In config.lua, list the
mini-game slugs available on your server:
Config = {
games = {
"lockpick",
"wire",
"memory"
}
} Each slug matches a game created on the web app — e.g. a project
at /lockpick becomes "lockpick" in the list.
Call the export from any resource to start a game:
local completed = exports['zh_minigame']:StartMinigame("lockpick")
if completed then
print("Player won!")
else
print("Player failed or cancelled.")
end StartMinigame blocks until the player finishes —
returns true on success, false on failure or if the game slug is
invalid.
Integrate NUI interface components (dialog, input, keypad, progress bar) into your FiveM server.
Download zh_interface from the repository,
place the folder anywhere in your server's resources directory, then add to server.cfg:
ensure zh_interface
In config.lua, define each interface component
with its type, slug (matches a project on this web app), export name, and optional default data:
Config = {
debug = true,
interfaces = {
{
type = 'dialog',
slug = 'confirmdialog',
export = 'confirmdialog',
data = {
title = "Confirm Action",
message = "Are you sure?"
}
},
{
type = 'input',
slug = 'createcharacter',
export = 'createcharacter',
data = {
title = 'Create Character',
fields = {
{ type = 'text', label = 'First Name' },
{ type = 'text', label = 'Last Name' },
{ type = 'number', label = 'Age' }
}
}
},
{
type = 'keypad',
slug = 'securitypad',
export = 'securitypad',
},
{
type = 'progressbar',
slug = 'useitem',
export = 'useitem',
data = {
label = 'Using item...',
duration = 5000
}
},
}
} Available types:
dialog — confirmation dialog with title & messageinput — dynamic form with configurable fieldskeypad — numeric PIN padprogressbar — timed progress bar with label & durationEach slug must match a project created on this web app with the same type.
Call the export matching your interface name — it returns the result via promise:
-- Blocks until the player responds
local result = exports['zh_interface']:confirmdialog({
title = "Delete Garage?",
message = "This action cannot be undone."
})
if result then
print("Player confirmed!")
else
print("Player cancelled.")
endYou can override the default data by passing it as the first argument:
-- Returns an array of input values
local result = exports['zh_interface']:createcharacter({
title = "Register",
fields = {
{ type = 'text', label = 'Full Name' },
{ type = 'text', label = 'Email' },
}
})
if result then
local name, email = result[1], result[2]
print("Name:", name, "Email:", email)
end The fields array defines the form dynamically — no HTML changes needed.
When Config.debug = true, each interface gets a debug command:
-- Opens interface with its default config data /confirmdialogdebug
The Apply AI Suggestions button saves directly to the web app, then restart the resource to pull the latest version.
config.lua in zh_interface.Display a real-time head-up display (health, armor, stamina, hunger, thirst, vehicle speed & fuel) in your FiveM server.
Download zh_hud from the repository,
place the folder anywhere in your server's resources directory, then add to server.cfg:
ensure zh_hud
Edit config.lua with your HUD template name:
Config = {
debug = true,
default = {
player = "testhud",
vehicle = "testhudprompt"
},
kmh = true
} Options:
default.player — slug of your player HUD template on the web app (e.g. "testhud")default.vehicle — slug of your vehicle HUD template on the web app (e.g. "testhudprompt")kmh — true for km/h, false for mphdebug — set to true to enable verbose loggingConfig.default.player or Config.default.vehicle in zh_hud/config.lua.Learn how to write effective prompts to build amazing interactive mini-games and interface components for your FiveM server.
When creating a new mini-game, describe the controls, victory conditions, layouts, and timing requirements clearly. Specify what triggers a win, loss, or cancellation.
"Create a lockpick hacking game."
Better Prompt:"Create a lockpick game. It should show a circular dial with a lock. A needle rotates automatically. When the player presses Space, the needle must align with a highlighted sweet spot. If it hits, advance to the next level (3 levels total). If they miss, trigger a failure state."
Here are a few popular FiveM mini-game styles you can generate by describing them:
Interface components differ from mini-games — data is sent from a FiveM resource via Lua (title, message, fields, etc.). The AI only needs to design the look/ theme, not the specific content.
"Create a modern dialog."
Better Prompt:"Design a dark green glass-morphism dialog with a subtle glow border. Title should be in bold white, message in lighter gray. Buttons slide in from bottom — confirm is emerald green, cancel is gray. Add a soft fade-in background overlay."
Focus prompts on visuals, since the content data comes from Lua:
💡 Data like title, message, fields, duration will be filled
automatically from the exports['zh_interface']:namaExport(data) call in Lua — the prompt doesn't need to specify specific content.
A HUD is always visible on screen and displays real-time player & vehicle data — no exports or interactive clicks. The AI only needs to design the layout & style, because data values arrive automatically.
"Create a HUD with health and speed."
Better Prompt:"Design a minimal HUD for the bottom-center of the screen. Left side: a circular health bar (red) with the number inside. Right side: a circular armor bar (blue). Center: stamina bar as a thin horizontal line. When inside a vehicle, hide health/armor and show a speedometer on the left (large number) and a fuel bar on the right with a gas pump icon."
"Create a HUD. On the left side of the screen, show 5 circular stat rings stacked vertically: HEALTH (red heart icon), ARMOR (blue shield icon), STAMINA (green lightning icon), HUNGER (orange fork icon), THIRST (cyan water drop icon). Each ring is drawn on canvas with a glow effect. On the right side, show a semicircular speedometer gauge with tick marks and a needle, plus a fuel bar with a gas pump icon. The vehicle section should be hidden when not in a vehicle. Listen for postMessage events with action 'player' (key/value) and 'vehicle' (key/value) to update the HUD."
Available data your HUD can use:
Player data
health — 0–100armor — 0–100stamina — 0–100hunger — 0–100 (ESX)thirst — 0–100 (ESX)Vehicle data
inside — true/falsespeed — km/h or mphfuel — 0–100