Skip to content

Installation ​

Requirements ​

  • A recent FiveM server artifact (Lua 5.4)
  • oxmysql, the only hard dependency
  • Node 18+ to build the NUI once

Optional, auto-detected at start. Each one has a fallback, listed in Compatibility:

Kind Resources Used for
Framework es_extended (first target), qbx_core, qb-core Character identifier and name, cash, bank and dirty money, jobs and duty, society accounts, vehicle ownership and saved props. Without one it runs standalone: no economy, so every checkout is refused with "no economy", and vehicles live in np_mechanic's own table
Inventory np_inventory (first target), ox_inventory, qb-inventory mech_* part items, tools and consumables, supply stashes, hidden compartments, delivery crates. Without one there are no items: installs come from the shop's shelf and repairs use nothing up
Society accounts esx_addonaccount (ESX); Renewed-Banking, qb-banking or qb-management (qb / qbx) Payments for a job workshop go to the society of its job
Payments np_payments Checkout sheet, invoices for absent customers, refunds
HUD np_hud Toasts, key prompts and progress bars
Menu np_menu Radial entries, vehicle options in the third eye, server actions
Phone np_phone The "Mechanic" store app, texts, notifications, the Dynamic Island
Characters np_character Character names
Documents np_identification The driver's licence at a police inspection
Others np_discord, np_gangs, np_drugs, LegacyFuel or ox_fuel, qbx_vehiclekeys or qb-vehiclekeys Staff by Discord role, turf attention, police dispatch, fuel level, vehicle keys
Zones np_colshape Enter and exit of the workshop zones and the interaction points as colshapes. Needed on FiveM Legacy only, GTAV Enhanced has the natives built in. Without it, distance checks as before

Steps ​

  1. Put the resource in resources/ as np_mechanic. Item images use nui://np_mechanic/… and other resources call exports.np_mechanic, so keep the name.
  2. Build the NUI once:
    sh
    cd web && npm install && npm run build
    This creates web/dist/index.html (every screen) and web/dist/phone.html (the np_phone app). The item images in web/images/ are committed, so you don't need to render them.
  3. Database: the mech_* tables are created on the first start. sql/install.sql has the same schema if you prefer to run it by hand. See Tables.
  4. Add it to server.cfg after the framework, the inventory and the optional siblings:
    cfg
    ensure oxmysql
    ensure es_extended          # or qbx_core / qb-core
    ensure esx_addonaccount     # ESX: society accounts (society_mechanic, society_bennys, ...)
    ensure np_inventory         # or ox_inventory / qb-inventory
    ensure np_payments          # optional siblings before np_mechanic
    ensure np_hud
    ensure np_menu
    ensure np_phone
    ensure np_character
    ensure np_identification
    ensure np_discord
    ensure np_gangs
    ensure np_drugs
    ensure LegacyFuel           # or ox_fuel; qbx_vehiclekeys / qb-vehiclekeys on qb / qbx
    ensure np_mechanic
    Siblings may also start later or restart. np_mechanic attaches and detaches by itself and prints one console line each time.
  5. Create the jobs and societies (see below).
  6. Set up staff (see below).
  7. Items: with np_inventory there is nothing to do. With ox_inventory or qb-inventory add the item lines (see Items).
  8. Walk through Before you open it once on your server.

ESX with np_inventory

This is the combination np_mechanic is built for. np_inventory gets every mech_* item at runtime (label, image, usable), supply stashes and hidden compartments are guarded by np_inventory's beforeOpen hook, and dirty money is the black_money item. ESX societies come from esx_addonaccount.

Jobs and societies ​

The default config uses three framework jobs:

Job Workshops
mechanic Every Los Santos Customs location, Hayes, Beeker's
bennys Benny's (player-owned)
albany Albany Service & Repair (player-owned)

Create them in your framework:

  • ESX: rows in jobs and job_grades, plus an addon_account named society_<job> (esx_addonaccount).
  • qb / qbx: entries in shared/jobs.lua, and a society account in Renewed-Banking, qb-banking or qb-management.

Payments for a job workshop go to its society. Player-owned workshops have their own balance inside np_mechanic (see Player-owned workshops). Police inspection and fallback dispatch use the mechanic.inspect capability. With np_jobs absent, transition job names (default police and sheriff) live in Config.Jobs.fallback; move custom police job names there.

Staff ​

np_mechanic uses no ACE and nothing in server.cfg. A player is staff when one of these is true:

  1. The framework says so: Config.AdminGroups.esx (ESX groups admin, superadmin) or Config.AdminGroups.qb (qb / qbx permissions admin, god).
  2. One of their identifiers is in Config.Admins ('license:…', 'discord:…').
  3. np_discord runs and they hold one of Config.AdminDiscordRoles (role ids or np_discord role names).

Staff can give or clear a workshop owner (/mechowner <shop> <server id | none>). The same check gates the staff-only server RPCs (business.setOwner, underground.admin.heat, underground.admin.invite).

Items ​

Every item name starts with mech_, so nothing clashes with np_inventory's built-in repairkit, spare_tire, jerrycan or car_keys. The images are web/images/<item>.png.

Item What for
mech_part_engine, _intake, _ecu, _turbo, _transmission, _brakes, _suspension, _tyres, _armour, _nitrous, _compartment, _jammer One item per part slot, metadata { part, maker, tier, serial, condition, illegal }. Bought "parts only", taken out of a car or chopped. Used at a raised lift: self-install
mech_scanner OBD diagnosis anywhere. An officer on duty inspects with it
mech_toolbox Jump start (/jumpstart)
mech_repairkit, mech_tyre Quick fixes (use next to the car); repair consumables
mech_oil, mech_brakepads, mech_paint Repair consumables (workshop supply stash)
mech_fakeplate, mech_vinkit, mech_nitrous_bottle Underground: fake plate (use as the driver), VIN scrub (use in a shop with the service), nitrous refill
mech_crate A supplier delivery (business reorders)
mech_invite_haos, mech_invite_ghost, mech_invite_arena Invitations to the invite-only workshops
black_money Dirty money (Config.DirtyMoney). ESX without an item inventory uses the black_money account

np_inventory ​

Nothing to add. np_mechanic registers every mech_* item at runtime with its label, description, weight, image (nui://np_mechanic/web/images/<item>.png) and use. Check that one mech_part_* item shows its image.

ox_inventory (also qbx) ​

Add to ox_inventory/data/items.lua. The use goes through server.export = 'np_mechanic.<item>'.

ox_inventory item list
lua
['mech_part_engine'] = { label = 'Engine parts', weight = 18000, stack = false, close = true, description = 'A crate of engine internals. Maker and serial on the tag.',
                        client = { image = 'nui://np_mechanic/web/images/mech_part_engine.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_engine' } },
['mech_part_intake'] = { label = 'Intake kit', weight = 2500, stack = false, close = true, description = 'Filter, pipes and clamps.',
                        client = { image = 'nui://np_mechanic/web/images/mech_part_intake.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_intake' } },
['mech_part_ecu'] = { label = 'ECU module', weight = 600, stack = false, close = true, description = 'A flashed engine control unit.',
                     client = { image = 'nui://np_mechanic/web/images/mech_part_ecu.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_ecu' } },
['mech_part_turbo'] = { label = 'Turbo kit', weight = 6500, stack = false, close = true, description = 'Turbocharger with manifold and lines.',
                       client = { image = 'nui://np_mechanic/web/images/mech_part_turbo.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_turbo' } },
['mech_part_transmission'] = { label = 'Gearbox', weight = 14000, stack = false, close = true, description = 'A complete gearbox. Heavy.',
                              client = { image = 'nui://np_mechanic/web/images/mech_part_transmission.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_transmission' } },
['mech_part_brakes'] = { label = 'Brake kit', weight = 5200, stack = false, close = true, description = 'Discs, calipers and lines.',
                        client = { image = 'nui://np_mechanic/web/images/mech_part_brakes.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_brakes' } },
['mech_part_suspension'] = { label = 'Suspension kit', weight = 8000, stack = false, close = true, description = 'Springs, dampers and arms.',
                            client = { image = 'nui://np_mechanic/web/images/mech_part_suspension.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_suspension' } },
['mech_part_tyres'] = { label = 'Set of tyres', weight = 9000, stack = false, close = true, description = 'Four tyres, mounted and balanced.',
                       client = { image = 'nui://np_mechanic/web/images/mech_part_tyres.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_tyres' } },
['mech_part_armour'] = { label = 'Armour panels', weight = 20000, stack = false, close = true, description = 'Steel and composite panels for the doors and the floor.',
                        client = { image = 'nui://np_mechanic/web/images/mech_part_armour.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_armour' } },
['mech_part_nitrous'] = { label = 'Nitrous kit', weight = 7000, stack = false, close = true, description = 'Bottle, solenoids and a button. Not road legal.',
                         client = { image = 'nui://np_mechanic/web/images/mech_part_nitrous.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_nitrous' } },
['mech_part_compartment'] = { label = 'Hidden compartment', weight = 9000, stack = false, close = true, description = 'A false floor with a magnetic latch.',
                             client = { image = 'nui://np_mechanic/web/images/mech_part_compartment.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_compartment' } },
['mech_part_jammer'] = { label = 'Kill-switch jammer', weight = 800, stack = false, close = true, description = 'Blocks a remote engine stop.',
                        client = { image = 'nui://np_mechanic/web/images/mech_part_jammer.png' }, consume = 0, server = { export = 'np_mechanic.mech_part_jammer' } },
['mech_scanner'] = { label = 'OBD scanner', weight = 900, stack = false, close = true, description = 'Device diagnostic tablet. Reads fault codes.',
                    client = { image = 'nui://np_mechanic/web/images/mech_scanner.png' }, consume = 0, server = { export = 'np_mechanic.mech_scanner' } },
['mech_toolbox'] = { label = 'Toolbox', weight = 4500, stack = false, close = true, description = 'Power Metal sockets, wrenches and a torque wrench.',
                    client = { image = 'nui://np_mechanic/web/images/mech_toolbox.png' } },
['mech_repairkit'] = { label = 'Repair kit', weight = 2500, stack = true, close = true, description = 'Fixup roadside kit. Gets a car moving again.',
                      client = { image = 'nui://np_mechanic/web/images/mech_repairkit.png' }, consume = 0, server = { export = 'np_mechanic.mech_repairkit' } },
['mech_tyre'] = { label = 'Spare tyre', weight = 9000, stack = true, close = true, description = 'One Atomic tyre on a rim.',
                 client = { image = 'nui://np_mechanic/web/images/mech_tyre.png' }, consume = 0, server = { export = 'np_mechanic.mech_tyre' } },
['mech_oil'] = { label = 'Motor oil', weight = 1200, stack = true, close = true, description = 'Coolhand Lube, five litres.',
                client = { image = 'nui://np_mechanic/web/images/mech_oil.png' } },
['mech_brakepads'] = { label = 'Brake pads', weight = 900, stack = true, close = true, description = 'A set of Halt pads.',
                      client = { image = 'nui://np_mechanic/web/images/mech_brakepads.png' } },
['mech_paint'] = { label = 'Paint can', weight = 800, stack = true, close = true, description = 'Coverup touch-up paint.',
                  client = { image = 'nui://np_mechanic/web/images/mech_paint.png' } },
['mech_fakeplate'] = { label = 'Fake plate', weight = 600, stack = true, close = true, description = 'A plate that belongs to nobody.',
                      client = { image = 'nui://np_mechanic/web/images/mech_fakeplate.png' }, consume = 0, server = { export = 'np_mechanic.mech_fakeplate' } },
['mech_vinkit'] = { label = 'VIN kit', weight = 700, stack = true, close = true, description = 'Grinder, punches and fresh stickers.',
                   client = { image = 'nui://np_mechanic/web/images/mech_vinkit.png' }, consume = 0, server = { export = 'np_mechanic.mech_vinkit' } },
['mech_nitrous_bottle'] = { label = 'Nitrous bottle', weight = 6000, stack = false, close = true, description = 'A full Demonoil bottle.',
                           client = { image = 'nui://np_mechanic/web/images/mech_nitrous_bottle.png' }, consume = 0, server = { export = 'np_mechanic.mech_nitrous_bottle' } },
['mech_crate'] = { label = 'Parts crate', weight = 25000, stack = false, close = true, description = 'A supplier delivery for a workshop.',
                  client = { image = 'nui://np_mechanic/web/images/mech_crate.png' } },
['mech_invite_haos'] = { label = 'Card from Hao', weight = 10, stack = false, close = true, description = 'A black card with a time on the back.',
                        client = { image = 'nui://np_mechanic/web/images/mech_invite_haos.png' } },
['mech_invite_ghost'] = { label = 'Burner number', weight = 10, stack = false, close = true, description = 'A number and a knock code.',
                         client = { image = 'nui://np_mechanic/web/images/mech_invite_ghost.png' } },
['mech_invite_arena'] = { label = 'Bunker contact', weight = 10, stack = false, close = true, description = 'Somebody vouched for you.',
                         client = { image = 'nui://np_mechanic/web/images/mech_invite_arena.png' } },

qb-inventory ​

Add to qb-core/shared/items.lua and copy web/images/*.png to qb-inventory/html/images/.

qb-inventory item list
lua
mech_part_engine = { name = 'mech_part_engine', label = 'Engine parts', weight = 18000, type = 'item', image = 'mech_part_engine.png', unique = true,
                  useable = true, shouldClose = true, description = 'A crate of engine internals. Maker and serial on the tag.' },
mech_part_intake = { name = 'mech_part_intake', label = 'Intake kit', weight = 2500, type = 'item', image = 'mech_part_intake.png', unique = true,
                  useable = true, shouldClose = true, description = 'Filter, pipes and clamps.' },
mech_part_ecu = { name = 'mech_part_ecu', label = 'ECU module', weight = 600, type = 'item', image = 'mech_part_ecu.png', unique = true,
               useable = true, shouldClose = true, description = 'A flashed engine control unit.' },
mech_part_turbo = { name = 'mech_part_turbo', label = 'Turbo kit', weight = 6500, type = 'item', image = 'mech_part_turbo.png', unique = true,
                 useable = true, shouldClose = true, description = 'Turbocharger with manifold and lines.' },
mech_part_transmission = { name = 'mech_part_transmission', label = 'Gearbox', weight = 14000, type = 'item', image = 'mech_part_transmission.png', unique = true,
                        useable = true, shouldClose = true, description = 'A complete gearbox. Heavy.' },
mech_part_brakes = { name = 'mech_part_brakes', label = 'Brake kit', weight = 5200, type = 'item', image = 'mech_part_brakes.png', unique = true,
                  useable = true, shouldClose = true, description = 'Discs, calipers and lines.' },
mech_part_suspension = { name = 'mech_part_suspension', label = 'Suspension kit', weight = 8000, type = 'item', image = 'mech_part_suspension.png', unique = true,
                      useable = true, shouldClose = true, description = 'Springs, dampers and arms.' },
mech_part_tyres = { name = 'mech_part_tyres', label = 'Set of tyres', weight = 9000, type = 'item', image = 'mech_part_tyres.png', unique = true,
                 useable = true, shouldClose = true, description = 'Four tyres, mounted and balanced.' },
mech_part_armour = { name = 'mech_part_armour', label = 'Armour panels', weight = 20000, type = 'item', image = 'mech_part_armour.png', unique = true,
                  useable = true, shouldClose = true, description = 'Steel and composite panels for the doors and the floor.' },
mech_part_nitrous = { name = 'mech_part_nitrous', label = 'Nitrous kit', weight = 7000, type = 'item', image = 'mech_part_nitrous.png', unique = true,
                   useable = true, shouldClose = true, description = 'Bottle, solenoids and a button. Not road legal.' },
mech_part_compartment = { name = 'mech_part_compartment', label = 'Hidden compartment', weight = 9000, type = 'item', image = 'mech_part_compartment.png', unique = true,
                       useable = true, shouldClose = true, description = 'A false floor with a magnetic latch.' },
mech_part_jammer = { name = 'mech_part_jammer', label = 'Kill-switch jammer', weight = 800, type = 'item', image = 'mech_part_jammer.png', unique = true,
                  useable = true, shouldClose = true, description = 'Blocks a remote engine stop.' },
mech_scanner = { name = 'mech_scanner', label = 'OBD scanner', weight = 900, type = 'item', image = 'mech_scanner.png', unique = true,
              useable = true, shouldClose = true, description = 'Device diagnostic tablet. Reads fault codes.' },
mech_toolbox = { name = 'mech_toolbox', label = 'Toolbox', weight = 4500, type = 'item', image = 'mech_toolbox.png', unique = true,
              useable = false, shouldClose = true, description = 'Power Metal sockets, wrenches and a torque wrench.' },
mech_repairkit = { name = 'mech_repairkit', label = 'Repair kit', weight = 2500, type = 'item', image = 'mech_repairkit.png', unique = false,
                useable = true, shouldClose = true, description = 'Fixup roadside kit. Gets a car moving again.' },
mech_tyre = { name = 'mech_tyre', label = 'Spare tyre', weight = 9000, type = 'item', image = 'mech_tyre.png', unique = false,
           useable = true, shouldClose = true, description = 'One Atomic tyre on a rim.' },
mech_oil = { name = 'mech_oil', label = 'Motor oil', weight = 1200, type = 'item', image = 'mech_oil.png', unique = false,
          useable = false, shouldClose = true, description = 'Coolhand Lube, five litres.' },
mech_brakepads = { name = 'mech_brakepads', label = 'Brake pads', weight = 900, type = 'item', image = 'mech_brakepads.png', unique = false,
                useable = false, shouldClose = true, description = 'A set of Halt pads.' },
mech_paint = { name = 'mech_paint', label = 'Paint can', weight = 800, type = 'item', image = 'mech_paint.png', unique = false,
            useable = false, shouldClose = true, description = 'Coverup touch-up paint.' },
mech_fakeplate = { name = 'mech_fakeplate', label = 'Fake plate', weight = 600, type = 'item', image = 'mech_fakeplate.png', unique = false,
                useable = true, shouldClose = true, description = 'A plate that belongs to nobody.' },
mech_vinkit = { name = 'mech_vinkit', label = 'VIN kit', weight = 700, type = 'item', image = 'mech_vinkit.png', unique = false,
             useable = true, shouldClose = true, description = 'Grinder, punches and fresh stickers.' },
mech_nitrous_bottle = { name = 'mech_nitrous_bottle', label = 'Nitrous bottle', weight = 6000, type = 'item', image = 'mech_nitrous_bottle.png', unique = true,
                     useable = true, shouldClose = true, description = 'A full Demonoil bottle.' },
mech_crate = { name = 'mech_crate', label = 'Parts crate', weight = 25000, type = 'item', image = 'mech_crate.png', unique = true,
            useable = false, shouldClose = true, description = 'A supplier delivery for a workshop.' },
mech_invite_haos = { name = 'mech_invite_haos', label = 'Card from Hao', weight = 10, type = 'item', image = 'mech_invite_haos.png', unique = true,
                  useable = false, shouldClose = true, description = 'A black card with a time on the back.' },
mech_invite_ghost = { name = 'mech_invite_ghost', label = 'Burner number', weight = 10, type = 'item', image = 'mech_invite_ghost.png', unique = true,
                   useable = false, shouldClose = true, description = 'A number and a knock code.' },
mech_invite_arena = { name = 'mech_invite_arena', label = 'Bunker contact', weight = 10, type = 'item', image = 'mech_invite_arena.png', unique = true,
                   useable = false, shouldClose = true, description = 'Somebody vouched for you.' },

Until the items exist in ox_inventory or qb-inventory, parts cannot be handed out: a paid parts-only order stays open and is handed out at the next collection or login.

Tables ​

Table Holds
mech_meta Schema version and module state (lifts, repair jobs and bills, roadside calls, knock codes …)
mech_timers Timers and cooldowns that survive a restart
mech_ledger Every money movement and job, per shop or vehicle (kept Config.Ledger.keepDays, 90 days)
mech_inbox Texts for offline players without np_phone, shown at the next login
mech_shops Runtime overrides of Config.Shops and shop meta
mech_vehicles Per plate: VIN, model, owner, installed parts, wear, mileage, flags, fine tune, warranty (props only in standalone)
mech_service The service book
mech_orders Work orders
mech_staff Mechanic skills (XP) and per-character meta (reputation, saved colours …)
mech_heat Underground heat per player and per shop
mech_business Player-owned workshops: owner, balance, roster, settings, stats, deliveries
mech_stock Shelf stock per owned workshop and part

Vehicle props are merged into the framework's vehicle JSON (owned_vehicles.vehicle on ESX, player_vehicles.mods on qb / qbx), never replaced.

Check it works ​

The console prints one line per sibling at start: active, fallback (…) or missing export <name>. Then:

  1. Drive into a Los Santos Customs zone in your own car. E opens the tuner.
  2. Order a part with "Mechanic" while nobody is on duty: the NPC crew takes it and the car is ready after its timer.
  3. As a mechanic on duty, run /workorders, claim an order, raise the lift (E) and install (G).

Before you open it ​

The test suite cannot check the game itself. Walk through these once on your server:

  1. Coordinates (shared/config/shops.lua, business.lua): drive into every workshop zone, check the tuner prompt, park on each lift and raise it. The car must sit on the lift point, not in a wall. Move zones to your MLOs.
  2. Jobs and societies exist (mechanic, bennys, albany), and a payment lands in the society.
  3. Items in ox_inventory or qb-inventory (lists above). With np_inventory, check that one mech_part_* item shows its image.
  4. The flatbed: winch a car onto each model in Config.Roadside.towModels and adjust the attach offsets (Config.Roadside.towOffsets).
  5. Handling: a part's maker bonus and a fine tune are felt in the car (state bag npmVeh) and gone after the test drive.
  6. Police: an officer on duty with mech_scanner gets the inspection; off duty, the diagnosis.
  7. np_menu: decide whether its own tuning shop stays (see Compatibility).
  8. Chop shop: run the server with sv_entityLockdown strict (or at least relaxed), so clients cannot spawn networked cars to chop (see Underground → Chop shop).

Troubleshooting ​

Problem Fix
Blank screens Build the NUI (web/dist missing)
Checkout says "no economy" No framework runs: standalone has no money
Parts are never handed out ox / qb: add the item lines above. Without an inventory there are no part items
Payments don't reach the society The addon_account society_<job> (ESX) or the society account in your qb banking resource is missing
Nobody gets roadside calls Mechanics must be on duty at a legal workshop and switch "on call" on in the app or /mechanic (Config.Roadside.requireOnCall)
An officer gets the diagnosis instead of the inspection The officer lacks mechanic.inspect in np_jobs (or its transition rule in Config.Jobs.fallback), or is off duty
The car sits in a wall when the lift goes up Move the lift point in Config.Shops.<id>.lifts. Lifts must lie inside a zone, at least 3 m from its edge