- Unzip the
jg-mechanic-bundle
- Drag all 4 folders (
jg-mechanic
,jg-mechanic-props
,jg-vehiclemileage
andjg-textui
) into a new folder called[jg]
within your server'sresources
folder.
{% hint style="info" %} If you don't plan on using our new default Text UI, you don't need to transfer it to your server, and you can choose a different Text UI script in the config! {% endhint %}
- Inside of your
server.cfg
, add a new line after all your other resources have started:
ensure [jg]
- Now navigate into the
inventory
folder. You will need to follow a different guide depending on your chosen inventory. The item images can be found in theimages
folder.- ox_inventory
- qb-inventory
- esx_inventory
Now for the fun part! Let's get the script perfectly configured for your city. Inside of the config
folder you will find 4 different configuration files.
The main one you want to worry about is the config.lua
file. This is the core configuration for the script. Most integrations (such as framework, text UI, notifications and more) are automatically detected.
In this file, you will mainly want to customise mechanic locations, core pricing, servicing and tuning options.
If you want to dive deeper and really customise the script to your servers specific needs, we have 3 other config files for you to play with. It will allow you to fine tune how cosmetics, servicing & tuning (engine swaps, brakes, tyres, etc) work in your city. These files are heavily commented to help you understand them. They can be a little complicated, so only modify them if you know what you're doing and somewhat comfortable with Lua.
JG Mechanic tries to automatically make the required database changes. In some cases, this automatic installation fails and you need to make the changes manually.
Head into the install
folder within jg-mechanic
. Run the database/run.sql
file within your database software (could be PhpMyAdmin or HeidiSQL).
{% hint style="info" %}
If you get the error along the lines of cannot use the syntax IF NOT EXISTS
- then simply remove every instance of IF NOT EXISTS
from the run.sql file, and re-run it. It will still run fine.
{% endhint %}
{% hint style="danger" %} Make sure you are running this SQL code within the correct database - triple check and cross reference the name of the database! {% endhint %}
{% hint style="success" %} Using JG Advanced Garages? Skip this section, you're good to go, all vehicle modifications will be saved automatically with no configuration required if using v2.2.8 or newer! {% endhint %}
JG Mechanic uses your "vehicle properties" to save changes made your vehicle while using the script. Vehicle properties are typically stored in your player owned vehicles database table table, under a column such as mods
or vehicle
.
Our exports are designed for JG Mechanic, and offer many improvements on the typical functions included with your framework. We recommend, if you feel comfortable modifying your framework's code, to change to using our exports.
To make things as simple as possible, we have created 2 replacement exports for getting and setting these vehicle properties. If using QBCore or ESX, we can replace them in your core to keep things simple. There's also a guide for replacing the ox_lib functions, however ox_lib's functions are well written and will have no conflicts with JG Mechanicc. So that is very optional.
QBCore
- Navigate to
[qb]/qb-core/client/functions.lua
and locate the 2 functions:
QBCore.Functions.GetVehicleProperties(vehicle)
QBCore.Functions.SetVehicleProperties(vehicle, props)
- These are two very large functions - but we are going to entirely replace them. A life hack is on VSCode, you can collapse them with the little arrow near the line numbers to make it easy to delete them.
 (1) (1) (1) (1) (1).png)
- Replace these 2 functions with the following new code:
function QBCore.Functions.GetVehicleProperties(vehicle)
return exports["jg-mechanic"]:getVehicleProperties(vehicle)
end
function QBCore.Functions.SetVehicleProperties(vehicle, props)
exports["jg-mechanic"]:setVehicleProperties(vehicle, props)
end
You may be concerned about how much code you have removed. No need to worry: you can re-get this code from the QBCore GitHub at any time, and all the functionality has been replaced for you directly inside JG Mechanic. Now do a full server restart and you're ready to go!
ESX
- Navigate to
[core]/es_extended/client/functions.lua
and locate the 2 functions:
function ESX.Game.GetVehicleProperties(vehicle)
function ESX.Game.SetVehicleProperties(vehicle, props)
- These are two very large functions - but we are going to entirely replace them. A life hack is on VSCode, you can collapse them with the little arrow near the line numbers to make it easy to delete them.
 (1) (1) (1) (1) (1) (1).png)
- Replace these 2 functions with the following new code:
function ESX.Game.GetVehicleProperties(vehicle)
return exports["jg-mechanic"]:getVehicleProperties(vehicle)
end
function ESX.Game.SetVehicleProperties(vehicle, props)
exports["jg-mechanic"]:setVehicleProperties(vehicle, props)
end
You may be concerned about how much code you have removed. No need to worry: you can re-get this code from the ESX GitHub at any time, and all the functionality has been replaced for you directly inside JG Mechanic. Now do a full server restart and you're ready to go!
ox_lib (very very optional)
-
Navigate to
ox_lib\resource\vehicleProperties\client.lua
and locate the 2 functions:\function lib.getVehicleProperties(vehicle)
function lib.setVehicleProperties(vehicle, props, fixVehicle)
-
These are two very large functions - but we are going to entirely replace them. A life hack is on VSCode, you can collapse them with the little arrow near the line numbers to make it easy to delete them.
\
-
Replace these 2 functions with the following new code:\
---@param vehicle number ---@return VehicleProperties? function lib.getVehicleProperties(vehicle) return exports["jg-mechanic"]:getVehicleProperties(vehicle) end ---@param vehicle number ---@param props VehicleProperties ---@param fixVehicle? boolean Fix the vehicle after props have been set. Usually required when adding extras. ---@return boolean isEntityOwner True if the entity is networked and the client is the current entity owner. function lib.setVehicleProperties(vehicle, props, fixVehicle) exports["jg-mechanic"]:setVehicleProperties(vehicle, props) return not NetworkGetEntityIsNetworked(vehicle) or NetworkGetEntityOwner(vehicle) == cache.playerId end
You may be concerned about how much code you have removed. No need to worry: you can re-get this code from the Overextended GitHub at any time, and all the functionality has been replaced for you directly inside JG Mechanic. Now do a full server restart and you're ready to go!