> For the complete documentation index, see [llms.txt](https://hrs-scripts.gitbook.io/hrs-scripts-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hrs-scripts.gitbook.io/hrs-scripts-doc/hrs-base-building/snippets/crafting-related/qb-esx-adding-quasar-inventory-crafting-in-base-building.md).

# \[QB/ESX] Adding quasar inventory crafting in Base Building

## **In qs-inventory**

#### **qs-inventory**\\(any open client file).lua

In this code I created 3 types of crafting tables as an example, you can create the ones you want and choose the craftings you want

```lua
Config.craftingType = {
    ['med_table'] = {
        [1] = {
            name = "weapon_carbinerifle",
            amount = 1,
            info = {},
            costs = {
                ["tosti"] = 1,
            },
            type = "weapon",
            slot = 1,
            threshold = 0,
            points = 1,
            time = 5000,
            rep = 'attachmentcraftingrep',
             chance = 100
        },
        [2] = {
            name = "tosti",
            amount = 1,
            info = {},
            costs = {
                ["weapon_carbinerifle"] = 1,
            },
            type = "item",
            slot = 2,
            threshold = 0,
            points = 1,
            time = 5000,
            rep = 'attachmentcraftingrep',
             chance = 100
        },
    }, 

    ['weapon_table'] = {
        [1] = {
            name = "weapon_carbinerifle",
            amount = 1,
            info = {},
            costs = {
                ["tosti"] = 1,
            },
            type = "weapon",
            slot = 1,
            threshold = 0,
            points = 1,
            time = 5000,
            rep = 'attachmentcraftingrep',
             chance = 100
        },
        [2] = {
            name = "tosti",
            amount = 1,
            info = {},
            costs = {
                ["weapon_carbinerifle"] = 1,
            },
            type = "item",
            slot = 2,
            threshold = 0,
            points = 1,
            time = 5000,
            rep = 'attachmentcraftingrep',
             chance = 100
        },
    },

    ['normal_table'] = {
        [1] = {
            name = "weapon_carbinerifle",
            amount = 1,
            info = {},
            costs = {
                ["tosti"] = 1,
            },
            type = "weapon",
            slot = 1,
            threshold = 0,
            points = 1,
            time = 5000,
            rep = 'attachmentcraftingrep',
             chance = 100
        },
        [2] = {
            name = "tosti",
            amount = 1,
            info = {},
            costs = {
                ["weapon_carbinerifle"] = 1,
            },
            type = "item",
            slot = 2,
            threshold = 0,
            points = 1,
            time = 5000,
            rep = 'attachmentcraftingrep',
             chance = 100
        },
    },
}


function OpenCrafting(tab)
    if Config.craftingType[tab] then
        local crafting = {
            label = 'Craft',
            items = exports['qs-inventory']:SetUpCrafing(Config.craftingType[tab])
        }
        TriggerServerEvent('inventory:server:SetInventoryItems', Config.craftingType[tab])
        TriggerServerEvent("inventory:server:OpenInventory", "customcrafting", crafting.label, crafting)
    end
end 

AddEventHandler('openCraftingTable',function(tab)
    OpenCrafting(tab)
end)
```

## **In hrs\_base\_building**

#### **hrs\_base\_building**\config.lua

```lua
["prop_tool_bench02_ld"] = {
    item = "prop_tool_bench02_ld",
    life = 10000.0,
    type = "crafting",
    subtype = "findGroud",
    noFoundationNeed = true,
    TriggerEvent = {
        type = "client",
        event = 'openCraftingTable',
        args = {'normal_table'}, --- agrs in order
        entityAsArg = "hrs_base_entity" --- in the arguments, this word will be replaced by the Entity
    },
    crafting = {
        {name = "wood",count = 20}
    }
},

["bkr_prop_meth_table01a"] = {
    item = "bkr_prop_meth_table01a",
    life = 20000.0,
    type = "crafting",
    subtype = "findGroud",
    TriggerEvent = {
        type = "client",
        event = 'openCraftingTable',
        args = {'med_table'}, --- agrs in order
    },
    crafting = {
        {name = "wood",count = 20},
        {name = "metalscrap",count = 20}
    }
},

["gr_prop_gr_bench_02a"] = {
    item = "gr_prop_gr_bench_02a",
    life = 20000.0,
    type = "crafting",
    subtype = "findGroud",
    TriggerEvent = {
        type = "client",
        event = 'openCraftingTable',
        args = {'weapon_table'}, --- agrs in order
    },
    crafting = {
        {name = "wood",count = 20},
        {name = "metalscrap",count = 20}
    }
},
```
