# Setting up crafting in ox_inventory

> Build crafting in ox_inventory: crafting.lua benches, ingredients and durations, tools that lose durability, metadata on results, zones and a craftItem hook.

Source: https://fam-tools.com/guides/ox-inventory-crafting · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 9 min

**Short answer.** Add a bench to `ox_inventory/data/crafting.lua` with `items` (recipes), `points` or `zones` for where it can be used, an optional `blip` and `groups`. Each recipe has a `name`, `ingredients` (item → amount), `duration` in ms and optional `count` and `metadata`. An ingredient value below 1 is a tool: it is not consumed but loses that fraction of durability (for example `WEAPON_HAMMER = 0.05` = 5%).

## Key points

- Benches live in `data/crafting.lua`.
- `ingredients = { scrapmetal = 5 }` consumes 5 scrap.
- Values below 1 are tools that lose durability.
- `groups` restricts benches to jobs or gangs.
- Use a `craftItem` hook to log or block crafts.

Crafting turns scrap, parts and tools into useful items — lockpicks, repair kits, attachments, even weapons. ox_inventory handles the bench UI, ingredient checks and timers; you describe recipes in a data file.

## A crafting bench

*ox_inventory/data/crafting.lua*

```lua
{
    name = 'mechanic_bench',
    items = {
        {
            name = 'lockpick',
            ingredients = {
                scrapmetal = 5,
                WEAPON_HAMMER = 0.05,
            },
            duration = 5000,
            count = 2,
        },
        {
            name = 'repairkit',
            ingredients = { scrapmetal = 10, plastic = 4 },
            duration = 8000,
        },
    },
    zones = {
        { coords = vec3(-346.1, -130.45, 39.0), size = vec3(3.8, 1.05, 0.15), distance = 1.5, rotation = 70.0 },
    },
    groups = { mechanic = 0 },
    blip = { id = 566, colour = 31, scale = 0.8 },
},
```

## Tools and durability

`WEAPON_HAMMER = 0.05` means the hammer must be in the inventory and loses 5% durability per craft instead of being used up. When durability reaches zero the tool breaks. It is a simple way to make tools matter without making them consumables. Durability itself is item metadata — see [item metadata](https://fam-tools.com/guides/ox-inventory-metadata).

## Crafting weapons and attachments

- Put weapon benches in hard-to-reach places and restrict them to gangs with `groups`.
- Give crafted weapons `metadata = { registered = false }` or custom serials for police roleplay — see [serial numbers](https://fam-tools.com/guides/fivem-weapon-serial-numbers).
- Balance ingredient costs against shop prices so crafting is an alternative, not a money printer.

## Logging crafts

*server.lua*

```lua
exports.ox_inventory:registerHook('craftItem', function(payload)
    print(('player %s crafted %s'):format(payload.source, payload.recipe.name))
end, { itemFilter = { WEAPON_PISTOL = true } })
```

## Questions

### How do I add crafting to ox_inventory?

Add a bench to `data/crafting.lua` with recipes, a location (points or zones) and optional groups.

### What does an ingredient value like 0.05 mean?

The item is a tool: it is not consumed but loses 5% durability per craft.

### Can I restrict a crafting bench to a gang?

Yes, with `groups = { gangname = 0 }`.

### Can crafted items have metadata?

Yes — add `metadata` to the recipe, for example `{ registered = false }` for a weapon.

## Related

- https://fam-tools.com/guides/ox-inventory-items-lua
- https://fam-tools.com/guides/ox-inventory-metadata
- https://fam-tools.com/guides/ox-inventory-hooks
- https://fam-tools.com/guides/fivem-weapon-serial-numbers
