How mistextreme/rup-vehiclespawner works
Purpose and Runtime
rup-vehiclespawner is a FiveM resource for browsing and spawning vehicles through an in-game NUI menu. The resource manifest at fxmanifest.lua defines the client/server scripts and web UI entry page.
Resource Entry Points
• fxmanifest.lua is the FiveM integration boundary, loading shared configuration plus client and server runtime scripts.
• client/client.lua is the main gameplay-side entry point: it receives user input/menu actions and performs vehicle-spawn behavior.
• server/server.lua is the server-side entry point for authoritative events and coordination.
• web/index.html starts the browser-based NUI interface.
Client Menu and Spawn Flow
The client layer opens the NUI, supplies vehicle/menu data, and receives browser callbacks:
• client/client.lua owns player-facing control flow and native FiveM interactions.
• client/export_menu.lua exposes menu-opening behavior for other resources.
• client/export_result.lua exposes selection/spawn results or related integration output.
The browser sends the selected vehicle/action back to the Lua client; the client is the boundary between untrusted UI input and FiveM game natives.
Vehicle Data and Custom Images
Vehicle catalog/content is data-driven:
• data.json provides the primary vehicle data source.
• 1.json is an additional packaged data file.
• custom_images.json and web/custom-images.json map vehicles to custom UI imagery.
The web layer consumes the catalog/image mappings to render choices, while the client/server scripts use selection identifiers to drive spawning or export behavior.
NUI Front End
The embedded web application renders the vehicle selector and interaction feedback:
• web/index.html defines the NUI document.
• web/script.js implements menu state, selection handling, and FiveM NUI messaging/callbacks.
• web/style.css provides presentation.
• web/images contains vehicle/menu imagery; web/sound contains UI feedback audio.
This is not a standalone web deployment: it runs in FiveM’s Chromium NUI environment and communicates with Lua through NUI messages.
Server Responsibilities and Updates
Server logic is split between operational event handling and update support:
• server/server.lua handles server runtime behavior and client-triggered server events.
• server/export_vehicles.lua exposes vehicle-related functionality to dependent FiveM resources.
• server/updater.lua implements resource update/version-related behavior, likely involving an external remote endpoint.
Server code forms the trust/coordination boundary for actions that should not be left solely to the client.
Configuration and Integration Surface
• config.lua centralizes resource behavior/settings shared by runtime scripts.
• client/export_menu.lua, client/export_result.lua, and server/export_vehicles.lua are the intended cross-resource API surface.
• FiveM/Cfx.re is the material host platform; its client natives, server event system, exports, and NUI bridge are the core infrastructure dependencies.
Components 17
FiveM Host
- Resource Manifest · Registers runtime scripts and the NUI page.
fxmanifest.lua - FiveM/Cfx.re · Provides natives, events, exports, and the NUI bridge.
- Shared Config
config.lua
Client Runtime
- Gameplay Controller · Controls menu input and vehicle spawning through FiveM natives.
client/client.lua - Menu Export · Cross-resource menu-opening API.
client/export_menu.lua - Result Export · Cross-resource selection and spawn result API.
client/export_result.lua
Server Runtime
- Server Coordinator · Handles authoritative events and coordination.
server/server.lua - Vehicle Export · Vehicle API for dependent resources.
server/export_vehicles.lua - Update Support · Performs version and resource update checks.
server/updater.lua
NUI Front End
- NUI Document
web/index.html - Vehicle Selector · Maintains menu state and sends NUI callbacks.
web/script.js - NUI Presentation
web/style.css - Images and Sounds
web/images
Vehicle Content
- Vehicle Catalog · Primary packaged vehicle definitions.
data.json - Additional Vehicle Data
1.json - Custom Image Maps · Maps vehicle identifiers to UI imagery.
custom_images.json - Web Image Map
web/custom-images.json
Connections 23
- Resource Manifest → FiveM/Cfx.re: resource registration
- Resource Manifest → Shared Config: loads
- Resource Manifest → Gameplay Controller: loads client
- Resource Manifest → Server Coordinator: loads server
- Resource Manifest → NUI Document: sets UI page
- Shared Config → Gameplay Controller: settings
- Shared Config → Server Coordinator: settings
- Menu Export → Gameplay Controller: opens menu
- Gameplay Controller → Result Export: publishes result
- Gameplay Controller → Vehicle Selector: NUI messages
- Vehicle Selector → Gameplay Controller: selection callback · Untrusted browser input enters the game client here.
- Gameplay Controller → FiveM/Cfx.re: vehicle natives
- Gameplay Controller → Server Coordinator: server events
- Server Coordinator → Vehicle Export: exposes vehicles
- Server Coordinator → Update Support: update support
- NUI Document → Vehicle Selector: loads
- NUI Document → NUI Presentation: styles
- Vehicle Selector → Images and Sounds: uses
- Vehicle Catalog → Vehicle Selector: vehicle choices
- Additional Vehicle Data → Vehicle Selector: additional choices
- Custom Image Maps → Vehicle Selector: image mapping
- Web Image Map → Vehicle Selector: web image mapping
- Vehicle Selector → Gameplay Controller: vehicle identifier