QBCore Frameworkqbcore.netCommunity docs
On this page

Updated 2026-10-11 · 5 min read

qb-crafting: recipes, workbenches and XP

The qb-crafting repository contains item and attachment crafting benches, ingredient requirements, crafting reputation and an optional minigame. The README is short; the actual integration contract is in the Lua source.

Important: The reviewed server has security and transaction-integrity limitations. Read the security section before enabling this resource for real players.

Requirements and installation

The manifest loads QBCore locale helpers, config.lua, client.lua and server.lua. It does not itself enumerate all runtime dependencies.

The source calls these resources:

  • qb-core — shared item definitions, callbacks and player reputation
  • qb-inventory — ingredients, crafted items and workbench items
  • qb-input — amount selection
  • qb-menu — available recipes
  • qb-target — interactions with spawned crafting benches
  • qb-minigames — Skillbar when Config.EnableSkillCheck is enabled
  • QBCore progressbar integration — progress UI

After downloading the official repository, start those dependencies before qb-crafting. Ensure item_bench, attachment_bench and every recipe item exist in the installed shared item definitions and inventory images. The resource ships no dedicated SQL file; it relies on player metadata/inventory persistence.

Recipe structure

The official config defines Config.item_bench and Config.attachment_bench. Each has an object model, xpType and recipes array. Config.EnableSkillCheck selects the optional skill check.

-- Example to add INSIDE Config.item_bench.recipes.
-- Ensure both item names exist in your installed shared item table.
{
    item = 'lockpick',
    xpRequired = 0,
    xpGain = 1,
    requiredItems = {
        { item = 'metalscrap', amount = 22 },
        { item = 'plastic', amount = 32 },
    },
},

Fields:

FieldMeaning
itemOutput item name from QBCore shared items
xpRequiredMinimum reputation to show/unlock the recipe
xpGainReputation gained per craft amount
requiredItemsArray of material item and amount pairs
xpType on benchMetadata reputation key, e.g. craftingrep
object on benchGTA object model spawned for the bench

Only add the recipe inside the existing table; do not duplicate Config.item_bench or assume the example is a complete config.lua.

What happens when a player crafts?

  1. A player uses a bench item; the client creates the bench object and adds qb-target interactions.
  2. The menu reads the player's metadata reputation and inventory using crafting:getPlayerInventory.
  3. The player chooses an amount via qb-input. An enabled minigame runs exports['qb-minigames']:Skillbar('easy', '12345').
  4. After progress completion, the client calls qb-crafting:server:receiveItem with bench type, recipe output and quantity.
  5. The server looks up the configured recipe, checks reputation, attempts ingredient removals and calls qb-inventory:AddItem for the result.

The menu/skill-check is a client experience, not independent authorization.

Relevant events and callbacks

SideNameWhat it does
Client eventqb-crafting:client:useCraftingTablePlaces the specified bench item
Server callbackcrafting:getPlayerInventorySupplies the current player's inventory to the menu
Server eventqb-crafting:server:receiveItemAttempts to craft a configured recipe
Server eventqb-crafting:server:removeMaterialsRemoves materials after a failed skill check
Server eventqb-crafting:server:removeCraftingTableConsumes a bench item
Server eventqb-crafting:server:addCraftingTableReturns a bench item on pickup

These names are internal to the bundled resource. Avoid exposing them as generic publicly callable integrations.

Server-side validation and known limits

The reviewed server.lua validates that a requested recipe exists and that reputation is high enough. However, it does not establish all of the following:

  • The numeric craft amount is a bounded positive integer (the handler converts with tonumber and checks > 0, but not an integer or maximum).
  • The player is actually near and entitled to use the specified bench.
  • Ingredient removal and output grant are atomic. If a later removal or output grant fails, earlier deductions are not rolled back.
  • The removeMaterials event validates its caller-supplied item name and amount against a failed server-verified skill check.
  • The separate bench return/consume events are linked to an authoritative placed bench entity.

A public server should close these gaps in a maintained fork before enabling crafting. At minimum, keep requests server-authorized, validate integer quantity and available capacity, enforce location/bench ownership, verify ingredient amounts and complete the inventory transaction with recoverable failure handling. A menu-side materials check does not protect the server.

See safe server events and the inventory API reference for related patterns.

Troubleshooting

SymptomCheck
Crafting menu does not appearqb-target, spawned bench entity, item registration and console
Blank item name or imageCorrect QBCore.Shared.Items entry and Config.ImageBasePath
Crafting never completesProgressbar, qb-minigames dependency and installed callback names
No materials recognizedcrafting:getPlayerInventory response and item names
Recipe lockedmetadata.craftingrep (or the configured xpType) and xpRequired
Ingredients disappear on failurePartial non-atomic removal behavior in server.lua; investigate before reattempting

Update checklist

  1. Pin the resource commit and compare upstream config.lua to local recipes.
  2. Verify every ingredient/output/workbench item exists in your actual inventory.
  3. Exercise success, failure, repeated, malformed, very large and disconnected-player crafting requests on a disposable staging server.
  4. Do not deploy until server-side authorization and transaction boundaries are proven for your fork.

Sources

Repository · Recipe config · Client UI/workbench flow · Server events and security boundary

Found an issue in this guide?

Send the page URL, the affected example, and a source or reproduction to the site maintainer. For a server or resource problem, use the support guide.

On this page

Leonida RP server website built with RPWebsite
RPWebsite

Advertisement · RPWebsite

Want a website for your server?

Launch a site with live player status, rules, and a join button in minutes.

Build your website