Scripts
Advanced Mining Job
Hands-on mining with a real production chain. Break the rock, clean and smelt the ore, sell the bars.
- Requires
- ox_lib
- Frameworks
- Standalone, works with any framework
- Target & inventory
- ox or qb target; ox, qb or ps inventory; or your own
#Install
#Install dependencies
Install (or update)
ox_lib, and start it before this script in yourserver.cfg.#Check your inventory, target, notify and progress bar
Besides
ox_lib, the script needs an inventory, a target, notifications and a progress bar. Pick yours undersysteminconfigs/cl_config.lua:'ox'or'qb'work out of the box.Using something else? Make your own in
utils/cl_utils.luaandutils/sv_utils.lua. These are the calls the script makes, shown with theoxresources:lua-- Client side return exports.ox_inventory:Search('count', item) >= count -- Server side return exports.ox_inventory:AddItem(source, item, count, metadata or nil) return exports.ox_inventory:RemoveItem(source, item, count) return exports.ox_inventory:Search(source, 'count', item) >= count return exports.ox_inventory:CanCarryItem(source, item, count) return exports.ox_inventory:GetItemCount(inv, itemName, metadata, strict)lua-- Client side return exports.ox_target:addSphereZone({ name = data.name, coords = data.coords, radius = data.radius or 1.0, debug = data.debug or false, options = utils.getTargetOptions(data.options) }) return exports.ox_target:addLocalEntity(entity, utils.getTargetOptions(options))lua-- Client side lib.notify({ title = data.title or '', description = data.description or '', type = data.type or 'info', position = data.position or 'bottom', duration = data.duration or 3000, }) -- Server side TriggerClientEvent('ox_lib:notify', data.source, data, data.position or 'bottom')lua-- Client side local success = lib.progressBar({ duration = data.duration, position = 'bottom', label = data.label, useWhileDead = false, canCancel = data.canCancel == nil and true or data.canCancel, disable = data.disable, anim = data.anim, prop = data.prop, })#Add the items
The
INSTALLfolder has every item and image ready.- Copy the items from
INSTALL/ox-inventory.luaintoox_inventory/data/items.lua - Copy the images from
INSTALL/imagesintoox_inventory/web/images
Each item looks like this:
lua["l3th_rock"] = { label = "Rock", weight = 2500, stack = true, close = true, client = { image = "l3th_rock.png", } },- Copy the items from
INSTALL/qb-inventory.luaintoqb-core/shared/items.lua - Copy the images from
INSTALL/imagesintoqb-inventory/html/images
Each item looks like this:
lua['l3th_rock'] = {['name'] = 'l3th_rock', ['label'] = 'Rock', ['weight'] = 2500, ['type'] = 'item', ['image'] = 'l3th_rock.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Just a rock'},- Copy the items from
#Get a pickaxe
Players mine with a pickaxe weapon. Any pickaxe asset works; we recommend this free one:
#Start the script
- Put the
l3th-minerjobfolder in your resources folder - Add
ensure l3th-minerjobto yourserver.cfg, after its dependencies - Restart the server
- Put the
#Configuration
Settings are in configs/: cl_config.lua (blips, locations, the pickaxe shop), sv_config.lua (rocks and rewards) and sh_config.lua.
#Need help?
Most issues come from a missing dependency or the wrong start order in server.cfg, so run through the steps once more first. Still stuck? See Common problems or open a ticket on Discord.