🔨Craft Menu
🌐 Translations
You can edit all menu translations in html/translate.js (languages included: fr, en, de, it, es, pt).
System messages and tooltips can be configured in config.lua under the Config.Txt table.
🗄️ Database
No setup needed! Just run the script—the required table will be created automatically in your database. No manual database action required.
🚪 Opening the Crafting Menu
There are two ways to open the crafting menu:
- For the player’s current job: - TriggerServerEvent("bt_craft:openCraftMenu")
- For a specific job (e.g. “police”): - TriggerServerEvent("bt_craft:openCraftMenu", "police")
You can server-side, for example, link an item to the opening of the craft menu for a specific job:
exports.vorp_inventory:registerUsableItem("smuggler_book", function(data)
    TriggerEvent("bt_craft:openCraftMenu", "smuggler", data.source)
end, GetCurrentResourceName())➕ Adding a New Craft Recipe
To add a new recipe, edit your Config.Crafts table in the server script.
Example for the "smuggler" job:
Config.Crafts["smuggler"] = {
    {
        itemcraft = "moonshine",   -- Item given to the player
        level = 2,                 -- Required job level to craft
        craftTime = 5,             -- Craft time (seconds per item)
        requires = {
            [1] = { {item="alcohol", quantity=2}, {item="corn", quantity=4} },  -- 2 alcohol OR 4 corn
            [2] = { {item="sugar", quantity=2}, {item="honey", quantity=1} },   -- 2 sugar OR 1 honey
            [3] = { {item="glassbottle", quantity=1} }                          -- 1 glassbottle (mandatory)
        }
    },
}Field descriptions:
- itemcraft: The item the player will receive after crafting. 
- level: The minimum job level required to unlock the recipe. 
- craftTime: The time (in seconds) to craft one item. This is multiplied by the chosen quantity. 
- requires: Ingredient groups. Each numbered group represents alternative ingredients. The player must provide one option per group. 
Tip: You can add as many recipes as you want for each job, and as many alternative ingredients per step as needed.
🔌 Server Export: exports.bt_craft:GetPlayerCraftLevelXP
exports.bt_craft:GetPlayerCraftLevelXPRetrieve a player's crafting level and XP for a given job, synchronously.
Usage:
local level, xp = exports.bt_craft:GetPlayerCraftLevelXP(playerId, jobName)
print("Level:", level)
print("XP:", xp)- playerId: The server ID of the player. 
- jobName: The job to check (e.g., - "smuggler",- "police").
Returns:
- level(integer) — Player’s crafting level for the specified job.
- xp(integer) — Player’s current XP for the specified job.
If the player/job does not exist yet, the function returns:
- 1for level
- 0for XP
Example:
local jobName = "smuggler"
local level, xp = exports.bt_craft:GetPlayerCraftLevelXP(source, jobName)
print(("Player %d - %s: Level %d, XP %d"):format(source, jobName, level, xp))📌 Notes
- Flexible integration: Crafting can be opened for any job, or for the player's own job, and recipes are fully customizable. 
- No DB headaches: The database is auto-managed. Just start the script! 
- Fully configurable: All translations and messages are editable for easy localization. 
- Powerful API: Server exports for craft XP/levels let you build advanced features (e.g., UI, ranks). 
Last updated

