# Installation & Configuration

{% stepper %}
{% step %}

### Add the resource

Drag the `dynyx_crafting` folder into your `resources` directory.

Make sure to rename the script from `dynyx_crafting-main` to `dynyx_crafting` or it will not work. Then make sure its in the correct location so the server can access it. Once done, add `ensure dynyx_crafting` to your `server.cfg` to activate the script.&#x20;
{% endstep %}

{% step %}

### Install Dependencies

**Ensure all required dependencies for the script are installed and up to date.**&#x20;

Dependencies usually include core resources like the frameworks (**QBCore**, **QBox** or **ESX**), target systems (`ox_target` or `qb-target`) and an inventory system like (`ox_inventory`, `qb-inventory`, `ps-inventory`, or `qs-inventory`). Missing dependencies may prevent the script from working property.
{% endstep %}

{% step %}

### Import the SQL File

**Open your database (like HeidiSQL or phpMyAdmin) and import the provided SQL file.**

This step adds the necessary table and data structure to your database, ensuring that the crafting system can store and retrieve relevant information.
{% endstep %}

{% step %}

### Configure Inventory Integration

**Navigate to your `inventory` folder.**

Choose the correct guide for your inventory system. Each guide has specific instructions and images for setting up item images and ensuring full compatibility with your chosen inventory.

* [ox\_inventory](/dynyx-scripts/crafting-system/installation-and-configuration/ox_inventory.md)
* [qb-inventory](/dynyx-scripts/crafting-system/installation-and-configuration/qb-inventory-ps-inventory.md) / [ps-inventory](/dynyx-scripts/crafting-system/installation-and-configuration/qb-inventory-ps-inventory.md)
* [qs-inventory](/dynyx-scripts/crafting-system/installation-and-configuration/qs-inventory.md)
  {% endstep %}
  {% endstepper %}

## Configuration:

```lua
Config = {}

Config.Lan = 'en' -- Sets the language for the script. Options: 'en' (English), 'es' (Spanish), 'de' (German), 'fr' (French)

-- Framework and system integrations
Config.Target = "ox_target" -- Determines which targeting system to use. Options: 'ox_target' or 'qb-target'
Config.Inventory = "ox_inventory" -- Determines which inventory system to use. Options: 'ox_inventory' / 'qb-inventory' / 'ps-inventory' / 'qs-inventory'
Config.Notifications = "ox_lib" -- Determines which notification system to use. Options: 'qb-core' or 'ox_lib'
Config.Progressbar = "ox_lib" -- Determines which progress bar system to use. Options: 'qb-core' or 'ox_lib'

-- Inventory image directory path
Config.InventoryImagePath = "ox_inventory/web/images" -- Sets the directory path for item images. Change based on the inventory system used.

-- Crafting level system
Config.LevelSystem = {
    StarterLevel = 0, -- The initial level when a player starts crafting. Recommended: 0
    IncreaseByAfterEachLevelUp = 500 -- The XP required for the next level increases by this amount each time the player levels up
}

-- Webhook settings for logging
Config.WebHooks = false -- Enable or disable webhook logging. 'false' means logging is disabled.
Config.WebHookURL = "PLACE_YOUR_WEBHOOK_HERE" -- Webhook URL for logging crafting-related activities (only used if WebHooks = true)

-- Crafting bench settings
Config.LifetimeofBench = 999999 -- Duration (in seconds) before the crafting bench despawns. '999999' effectively makes it permanent.
Config.SecondsBeforeXpGain = 5 -- The delay (in seconds) before a player gains XP after crafting an item.
Config.CamZoom = false -- Enable or disable scroll wheel zoom in the camera preview
Config.CamDrag = true -- Enable or disable camera rotation and tilt using mouse drag (LMB)
Config.ObjectOutlines = true -- Enable or disable outlines for preview objects
Config.OutlineColor = { r = 255, g = 215, b = 0, a = 255 } -- RGBA color used for preview object outlines (Gold)

Config.PreSetTables = {
    ["Table1"] = { -- Unique identifier for this crafting table (must be different for each table)
        Label = "Crafting table",  -- The name of the crafting table (displayed in UI)
        BenchProp = "gr_prop_gr_bench_02a",  -- The prop model for the crafting bench
        BenchCoords = vector4(586.8718, -3274.8003, 6.0696, 90.0),  -- Position & heading of the bench
        Groups = { "mechanic", "lostmc" },  -- Jobs/Gangs allowed to use this bench
        CitizenID = { "MNT68646" },  -- Specific players allowed to use this bench (QBCore/QBOX Use CitizenID, ESX Use Identifier)
        ["Items"] = { -- List of craftable items for this table
            ["WEAPON_PISTOL"] = { -- ITEM NAME
                Label = "Pistol", -- Display name for the weapon
                DefaultQuantity = 1, -- How many items are given per craft (e.g., crafting once gives 5 ammo)
                XPEnable = false, -- Enable XP system (true = XP is earned, false = no XP)
                Level = 0, -- Required crafting level to create this item
                xpGain = 5, -- Amount of XP gained when crafting this item
                UseBlueprint = true, -- Requires a blueprint to craft this item
                ShowOnList = false, -- If true, always shows the item in the crafting list; if false, only shows if the player owns the blueprint
                RemoveBlueprint = false, -- If true, the blueprint is consumed upon crafting
                BlueprintItem = "blueprint_pistol", -- Name of the blueprint item required to craft
                ConsumeDurability = 0, -- Set to 0 to disable durability consumption (Only applicable for ox_inventory)

                ["Material"] = { -- Materials required for crafting
                    ["rubber"] = { Label = "Rubber", amount = 1 }, -- Material name, label, and amount required
                },
                
                ["Prop"] = { -- Visual representation of the crafted item on the table
                    model = "w_pi_pistol", -- The prop model to be displayed when crafting
                    offset = vector3(1.3, 0.0, -0.3), -- Position offset for placing the prop on the table
                    rotation = vector3(0, 0, 0) -- Rotation values for positioning the prop correctly
                }
            },
            
-- REST OF THE CODE HERE

Config.PlaceableTables = {
    ["table_weapon"] = { -- Item name of the bench/table
        Label = "Weapon Crafting Table", -- The name of the crafting table (displayed in UI)
        BenchProp = "gr_prop_gr_bench_02a", -- The prop model for the crafting bench

        ["Items"] = { -- List of craftable items for this table
            ["WEAPON_PISTOL"] = { -- Weapon identifier (FiveM weapon hash name)
                Label = "Pistol", -- Display name for the weapon
                DefaultQuantity = 1,
                XPEnable = true, -- Enable XP system (true = XP is earned, false = no XP)
                Level = 0, -- Required crafting level to create this item
                xpGain = 3, -- Amount of XP gained when crafting this item
                UseBlueprint = true, -- Requires a blueprint to craft this item
                ShowOnList = false, -- If true, always shows the item in the crafting list; if false, only shows if the player owns the blueprint
                RemoveBlueprint = true, -- If true, the blueprint is consumed upon crafting
                BlueprintItem = "blueprint_pistol", -- Name of the blueprint item required to craft
                ConsumeDurability = 0, -- Set to 0 to disable durability consumption (Only applicable for ox_inventory)

                ["Material"] = { -- Materials required for crafting
                    ["rubber"] = { Label = "Rubber", amount = 1 }, -- Material name, label, and amount required
                },

                ["Prop"] = { -- Visual representation of the crafted item on the table
                    model = "w_pi_pistol", -- The prop model to be displayed when crafting
                    offset = vector3(1.3, 0.0, -0.3), -- Position offset for placing the prop on the table
                    rotation = vector3(0, 0, 0) -- Rotation values for positioning the prop correctly
                }
            },
-- REST OF THE CODE HERE
```

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dynyx-scripts.gitbook.io/dynyx-scripts/crafting-system/installation-and-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
