Installation
Resource-specific setup for nx_mechanic. Dependencies, database, admin access, and the first shop.
For server-wide prerequisites (artifacts, oxmysql, ox_lib), work
through the generic install guide
first. This page only covers what is specific to nx_mechanic.
Dependencies
The framework is detected at boot: ESX Legacy, QBCore or QBox. The
framework resource does not have to start before
nx_mechanic. Detection retries until it finds one. Pin it
with Config.Framework if you run more than one.
Required. Shops, lifts and co-op sessions are networked.
Optional. Parts as physical items. qb-inventory, qs-inventory, codem-inventory, core_inventory and the framework pockets are supported too.
Optional. Draws the screen of the tablet a mechanic holds while the panel is open. Without it the tablet prop and animation still play.
Banking and billing resources are detected too. Nothing needs to be
installed for either: without one, shop takings and invoices are kept in
nx_mechanic's own tables. See
Adapters for the list that ships.
Database
The resource creates its own tables. On first start it reads
sql/create.sql from the resource folder and runs it, and every
statement in that file is safe to run again, so nothing happens on later
starts.
If you would rather own your schema changes, import the file by hand before the first start:
mysql -u <user> -p <database> < sql/create.sqlThe schema creates:
| Table | Holds |
|---|---|
nx_mechanic_builds | The saved build for a plate. |
nx_mechanic_defaults | A department's default build per job and model. |
nx_mechanic_codes | Share codes. |
nx_mechanic_log | Audit rows for saves and services. |
nx_mechanic_vehicles | Per-plate vehicle record: base handling, tuning, wear, stance, nitrous, mileage. |
nx_mechanic_service_history | One row per part replaced. |
nx_mechanic_inspections | Inspection certificates. |
nx_mechanic_orders | Work orders. |
nx_mechanic_shops | Live shop state: label, access, owner, managers, prices, geometry. |
nx_mechanic_employees | The built-in employee roster. |
nx_mechanic_ledger | Every movement of money a commercial shop causes. |
nx_mechanic_society | Shop balances, when no banking resource is in use. |
nx_mechanic_invoices | Invoices, when no billing resource is in use. |
nx_mechanic_society and nx_mechanic_invoices stay empty when a
banking or billing resource is detected: those adapters leave the money
where that resource already keeps it.
Coming from nx_dutycustoms? The first start that finds
nx_mechanic_builds empty copies plate builds, department defaults and
share codes across. The old tables are left untouched, and nothing is
copied twice.
server.cfg order
ensure oxmysql
ensure ox_lib
ensure ox_target
# ensure your framework here (es_extended, qb-core, or qbx_core)
ensure ox_inventory # optional
ensure nx-3d # optional
ensure nx_mechanicAdmin access
The shop creator and the developer subcommands are gated on the
framework's own admin permission, not on an ACE. List the groups that
count in
Config.AdminGroups:
Config.AdminGroups = { 'admin', 'superadmin', 'god', 'owner' }On ESX these are group names; on QBCore and QBox they are matched against
the player's permission. A player in one of them can run
/mechanic creator. The developer
subcommands need the same permission and
Config.DevCommands, which ships off.
Your first commercial shop
Two ways in. Either edit Config.Shops, or place one in game.
Pick the shop kind
type = 'commercial' charges the customer.
access = 'self-service' lets the customer drive the panel and pay at
the end; access = 'mechanic' means only staff open it and the customer
approves the bill. A mechanic shop must name a job.
Add the entry
Config.Shops = {
{
id = 'lscustoms',
label = 'Los Santos Customs',
type = 'commercial',
access = 'self-service',
install = 'tablet',
job = 'mechanic', -- staff job, and the society that receives the income
blip = { sprite = 72, colour = 46, scale = 0.8 },
bays = {
{ coords = vector3(-337.4, -136.9, 39.0), size = vector3(8.0, 12.0, 5.0), rotation = 70.0 },
},
},
}A vehicle has to sit inside a bay before the workshop opens on it.
size is the full width, length and height of the box, and rotation is
in degrees.
Or place it in game
Run /mechanic creator as an admin. It
walks you through the fields, then lets you drag each bay, lift, dyno
spot and blip into place. What you place is written to
nx_mechanic_shops and appears for every player straight away, with no
restart and no config edit.
Set the prices
Config.Pricing decides what the shop
charges. mode = 'fixed' uses the flat price per category,
'percent' charges a share of the vehicle's value, 'combined' adds
both. An owner can adjust each category in game, up to
Config.Pricing.markupCap times the configured price.
Decide where the money goes
Config.Business.society picks the account
that receives the takings, and Config.Business.billing picks the
invoice system. Both ship on 'auto', which finds whatever you already
run.
Departments
A department shop is free and job-gated. Add the jobs to Config.Jobs,
then give each shop a jobs list:
Config.Jobs = {
police = { label = 'Police', minGrade = 0, defaultsMinGrade = 3 },
sheriff = { label = 'Sheriff', minGrade = 0, defaultsMinGrade = 3 },
}
Config.Shops = {
{
id = 'mrpd',
label = 'Mission Row PD',
type = 'department',
install = 'tablet',
jobs = { 'police', 'sheriff' },
blip = { sprite = 446, colour = 29, scale = 0.75 },
bays = {
{ coords = vector3(448.4, -1017.6, 28.6), size = vector3(10.0, 14.0, 5.0), rotation = 0.0 },
},
},
}minGrade is who may use the workshop at all; defaultsMinGrade is who
may save a build as the department's default for a model. A department
blip is only drawn for someone whose job is on the list.
By default a department vehicle means class 18 (Emergency). Add models
for packs that use another class, in
Config.Vehicles.
Items
Parts are only items when
Config.Tuning.requireItems is on, and it
ships off. If you turn it on, register the item definitions listed under
Parts as items.