How zerodevelops/zpause works
Project Type and Purpose
• zPause is a small standalone pause-menu “resource” for the FiveM framework (GTA V modding), implemented in Lua and an embedded HTML UI.
• It hooks into the client game, shows a minimal NUI (in-game browser) overlay, and communicates back to the client script; optionally the server script can handle remote logic (future extensibility).
File-Structure Analysis
• fxmanifest.lua
• Defines the resource, lists client.lua, server.lua, and NUI assets (HTML/CSS/JS).
• client/client.lua
• Listens for pause requests (e.g., key binds or game events), invokes the NUI resource, and handles NUI callbacks.
• server/server.lua
• (Optional) Receives events from the client for server-side checks or data; can broadcast events back to clients.
• html/
• index.html, listener.js, style.css, reset.css — the NUI interface loaded into the game’s browser context.
• LICENSE & README.md
• Documentation only; not part of runtime.
Key Components
a. Client Component (Lua)
• Sub-components: Input listener (pause key), NUI invoker, NUI callback handler.
b. NUI (HTML/JS/CSS)
• Static assets served by FiveM’s built-in HTTP server to the in-game browser.
• JS listens for DOM events (hover, click), sends messages to the client via SendNuiMessage & listens to RegisterNuiCallbackType.
c. Server Component (Lua)
• Receives events from client (e.g., “pauseMenuOpened”) via TriggerServerEvent; optionally sends back via TriggerClientEvent.
d. fxmanifest
• Resource manifest orchestrating registration of client, server, and NUI files.
Relationships & Data Flows
1. Client Input → Client Lua
2. Client Lua → NUI (Load HTML/CSS/JS)
3. User Interaction (Hover/Click) → listener.js → Client Lua (via NUI events)
4. Client Lua → Server Lua (TriggerServerEvent)
5. Server Lua → Client Lua (TriggerClientEvent), if used
• That all UI assets are local files loaded via the resource; there is no external HTTP dependency.
Architectural Patterns & Principles
• Separation of concerns: UI (HTML/CSS/JS) is completely decoupled from game logic (Lua).
• Event-driven communication: NUI events ↔ client Lua ↔ server Lua.
• Resource manifest pattern: fxmanifest orchestrates registrations and asset bundling.