Studios
Mechanic Jobhouse-3.jpg

Examples

SoonMechanic JobQbox
PAGE 04 OF 07  ·  CONFIGURATION → EXAMPLES → TROUBLESHOOTINGdocs.glitchstudios.dev
Browse docs

Use another banking resource#

Put a table of server-side functions in Mechanic.Integrations.banking in config/main.lua. get returns the balance, or nil when the account does not exist. add and remove return true when the money moved.

Mechanic.Integrations.banking = {
    resource = 'my_banking',      -- only used while this resource is started
    createsAccounts = false,      -- true when add() makes a missing account itself
    get    = function(account) return exports.my_banking:GetAccountBalance(account) end,
    add    = function(account, amount, reason) return exports.my_banking:AddMoney(account, amount, reason) end,
    remove = function(account, amount, reason) return exports.my_banking:RemoveMoney(account, amount, reason) end,
}

Add a work van#

Put this in a file in config/local/ so updates leave it alone. The key is the qbx job name of the shop. On-duty staff in a bay get Take Out Van in the radial menu.

Mechanic.WorkVehicles.myshop = {
    label = 'My Mechanic Shop',
    vehicleModel = 'speedo',
    livery = 0,
    colour = { 73, 31, 101 },
    plate = 'MYSHOP01',      -- fixed so the trunk and glovebox keep their items
    maxOut = 1,
    bayRadius = 2.5,
    bays = {
        vec4(0.0, 0.0, 0.0, 0.0),
    },
}

Add an addon engine sound#

Also in config/local/. With resource set, the sound is hidden while that resource is not started, so nobody can pick a bank your server does not stream.

Mechanic.Sounds['mybank'] = { label = 'V8 Muscle', tier = 2, addon = true, resource = 'my-sound-pack' }
Mechanic.ModelAudio = { ['mycar'] = 'sultan2' }

Turn on salvage from repairs#

Every item must exist in your ox_inventory.

Mechanic.Config.repairDrops = { { 'rubber', 0.85, 1, 2 }, { 'metalscrap', 0.45, 1, 2 }, { 'steel', 0.30, 1, 3 } }

Read a car's build from another resource#

-- server
local build = exports['glitch-mechanicJob']:GetBuild(plate)
local value = exports['glitch-mechanicJob']:GetResaleValue(plate)

-- list of illegal modification flags (strings); observation fields are optional
local flags = exports['glitch-mechanicJob']:InspectVehicle(plate, { tint = 1, neon = true, moving = true })

Other clients can read the same build through the glitchBuild entity state bag. It leaves out the fields clients do not need, such as who fitted each part and the car's original props.

-- client
local build = Entity(vehicle).state.glitchBuild
if exports['glitch-mechanicJob']:CarHasUnderglow(vehicle) then
    exports['glitch-mechanicJob']:OpenUnderglow()
end