Configuring this resource

This script allows you to easily build a customizable vehicle spawning menu for your FiveM server. Players can browse through categories and select the vehicles they are permitted to spawn.

We use the ox_lib resource to handle styling and display — this is the only dependency required.

📁 Installation

  1. Ensure ox_lib is installed Download and install ox_lib in your resources.

  2. Add MirrorParkStudios-VehicleSpawner to your resources folder

  3. Ensure it's started in your server.cfg:

    ensure ox_lib
    ensure MirrorParkStudios-VehicleSpawner
  4. Use /vs in-game (or customize the command name in the config)

⚙️ Configuration Options

You can find the configuration file at: 📁 Shared/Config.lua

This file allows you to customize how the menu is accessed, who can use it, and what order your menus appear in. Below is a breakdown of each option:


🔧 Config.Debug

Type: boolean Default: true

Enables or disables debug logging in the server/client console. Set this to false in production to reduce console noise.

Config.Debug = true

💬 Config.Command

Type: table Controls whether the /vs command is enabled, and what its name is.

Config.Command = {
    Enabled = true,     -- Set to false to disable the command entirely
    Command = "vs"      -- The command name players use in-game (e.g., /vs)
}

🔒 Config.RestrictionCheck

Type: function This function determines whether a player is allowed to open the menu. You can insert any logic based on job, permission, or player data. Return true to allow access, or false to block it.

Config.RestrictionCheck = function()
    -- Insert custom logic here for Job Checks

    return true -- Allow all users by default
end

🗂 Config.MenuOrder

Type: table (array of strings)

This controls the load order of menu structure files in your Shared/Menus/ folder. The entries should match the file names exactly without the .lua extension.

Config.MenuOrder = {
    "FP",
    "MO8"
}

For example, this would load Shared/Menus/FP.lua first, then MO8.lua.


📄 Example Menu Structure

We have chosen to allow you to create folders per menu that you would like, to prevent you becoming overwhelmed with one extremely long file.

You can find an example of a Menu structure at /Menus/_EXAMPLE.lua, which contains useful notes to help you build your desired menu. This will not be loaded unless you add _EXAMPLE to Config.MenuOrder.

Note: Every menu file must end with:

registerVehicleMenu(MenuIdentifier, MenuStructure)

🎯 Opening the Menu Manually

If you'd like to open the menu manually from another script, you can trigger the following client event:

TriggerEvent("MirrorParkStudios-VehicleSpawner:openMenu")

This will open the vehicle spawn menu for the current player, respecting the restriction check in your config.

Last updated