Studios
Mining Jobhouse-3.jpg

Installation

SoonMining JobQbox
PAGE 02 OF 07  ·  OVERVIEW → INSTALLATION → CONFIGURATIONdocs.glitchstudios.dev
Browse docs

Requirements#

Framework qbx_core (Qbox). ESX and plain QBCore are not supported.
Resources ox_lib, oxmysql, ox_target, ox_inventory
Server A FiveM server artifact with OneSync enabled.
Database MySQL or MariaDB through oxmysql. The three tables are created on first start.
Optional glitch-xpSystem (levels, XP and perks), glitch-uiElements (contract step list), glitch-minigames (swing minigame), rc-interactions (foreman dialogue), sd-phone (crew groups), qbx_vehiclekeys (truck keys), a fuel script that reads the fuel state bag such as ox_fuel, glitch-pauseMenu (map legend names), glitch-admin (job log), glitch-treasury (shop purchases booked as money leaving the economy), glitch-buffs (fatigue from cutting ore)

Tested with qbx_core 1.24.0, ox_inventory 2.48.0, ox_lib 3.40.0, ox_target 1.17.2 and oxmysql 2.14.2.

The resource checks for each optional resource at run time. When one is not running, its feature is skipped or falls back to ox_lib, and the rest of the job works as normal. Every call into them sits in server/bridge.lua or client/bridge.lua. Both files are open in the escrow, so you can point the job at another XP system, logger, phone, keys or fuel script.

Installation steps#

  1. Copy the glitch-miningJob folder into your resources folder. The folder name is the resource name and is case-sensitive, so keep it exactly as glitch-miningJob. The service kit item calls glitch-miningJob.useServiceKit, and the rc-interactions flow fires glitch-miningJob:rc:* events, so both break under any other name.

  2. Add the items. Paste the entries from install/items.lua into ox_inventory/data/items.lua: mining_pick, mining_service_kit, raw_ore, ore_sack and washed_ore. Contracts stay closed until ore_sack and washed_ore exist, and the server console says so at every start. ox_inventory reads its item list only at start, so restart the server afterwards.

  3. Copy the icons. Put the PNGs from images/ into ox_inventory/web/images/. Then set Config.ImageBase in config/main.lua (see Configuration), because the package default loads icons from the Glitch Studios CDN.

  4. Pick a gem item. The Gem assessment perk hands out Config.Gems.item (diamond by default), which this package does not add. Use an item your server already has, or set item = false. If the item is missing, the console warns at start and the perk finds nothing.

  5. Database. The tables mining_contracts, mining_entitlements and mining_veins are created when the resource starts. If your database user cannot create tables, run install/mining.sql once by hand.

  6. Add the resource to server.cfg, after ox_lib, oxmysql, qbx_core, ox_inventory and ox_target, and after any optional resources you use:

    ensure ox_lib
    ensure oxmysql
    ensure qbx_core
    ensure ox_inventory
    ensure ox_target
    # optional, only the ones you run
    ensure glitch-uiElements
    ensure glitch-minigames
    ensure glitch-xpSystem
    ensure glitch-miningJob
    
  7. Pick your keys and fuel setup with Config.VehicleKeys and Config.Fuel.

  8. Optional: import the foreman dialogue. In the rc-interactions editor (/interactioneditor), import rc-interactions/mining_foreman.json and press Save. The job finds the flow by the name in Config.Interactions.projectName.

  9. Check the places. The foreman, truck bay, wash station and 16 veins in config/locations.lua are set up at the quarry in the Grand Senora Desert under the name Peats Ridge Quarry. Keep them, edit the file, or walk to each spot in the city with /miningadmin. That command saves to data/locations.json, so the data folder has to exist and be writable by the server.

  10. Give staff the admin command. /miningadmin is restricted to group.admin through the ACE command.miningadmin. To give it to another group:

    add_ace group.mod command.miningadmin allow
    
  11. Start the server and walk up to the foreman. With the dialogue imported the ox_target option is Talk to the foreman, without it Work tablet.

Optional integrations#

glitch-xpSystem: the resource reads levels and XP from the mining category (Config.XPCategory), and these perk effect ids from the mining skill tree:

Effect id What it does
mining_tool Wider swing window and less pick wear
mining_survey Rank 1 shows the grade when surveying, rank 2 makes surveys 30% faster
mining_handling One more unit per rank in the ore sack
mining_wash Lower wash rejects
mining_tailings Chance a wash gives one extra unit
mining_value More pay, capped by Config.Pay.perkCap
mining_coordinator The crew washes 2 more units per batch
mining_deep Unlocks the Deep orders
mining_gem Deep orders can turn up Config.Gems.item
mining_motherlode Once a day, every cut from the first rich vein surveyed gives two units
mining_foreman The crew uses the leader's tool and wash perks when they are higher

Without glitch-xpSystem every player counts as level 1, no XP is given, nobody has perks and the Deep orders stay locked.

glitch-uiElements: draws the contract step list on the side of the screen. Without it the current step shows in the ox_lib text UI (Config.TaskListFallback).

glitch-minigames: the bar-hit swing minigame at a rock face. Without it an ox_lib skill check is used.

rc-interactions: a dialogue with the foreman. Without it, or when the flow is not imported, the foreman has the plain Work tablet and Hand over the ore options.

sd-phone: crews come from the leader's active phone group. Without it every player works solo.

Commands#

Command Who What
/miningadmin command.miningadmin (group.admin) Move the foreman, truck bay and wash station, add or remove veins, show location labels, testing mode
miningstatus Server console only Lists every vein and every running contract

Updating#

Replace everything except config/, locales/ (if you translated or edited text) and data/locations.json, then restart the resource. data/locations.json holds the places saved with /miningadmin, so keep it. Compare the new config/ files and install/items.lua with yours, copy across any new settings or items, and read CHANGELOG.md for changed install steps. The tables are created with CREATE TABLE IF NOT EXISTS, so a restart is enough for the database.