Skip to content

Crafting Items

Crafting items are defined in /data/craft.lua.

Items are defined with key, value pairs. Key serves as the ID of the recipe and will be used to refer by the code.

Options

  • itemName string — The item name of the item being crafted

  • label? string — Setting this option will override the original item label

  • type? string — When set to car will craft a vehicle with the model of the itemName

  • category string — The label used to group the item in the NUI

  • description? string — Description of the item shown in the NUI, will use the default description if not defined

  • stats? table[] — Statistics shown under the description to provide further information about the item, can be used to show vehicle speed or weapon damage

    • icon string — Any icon from Iconify
    • color string — Colour of the icon
    • label string
    • value string
  • time number — Crafting time in second

  • level? number — Level required to use this recipe, you must set enableLevel to true in settings.lua to use this option

  • exp? number — Exp given to the player when the crafting is done, you must set enableLevel to true in settings.lua to use this option

  • recipe table[] — Items to be consumed

    • itemName string
    • count number
  • tools? table[] — Items required to craft the item, but will not be consumed

    • itemName string
    • count number

Examples

lua
local crafts = {
    ['bandage'] = {
        itemName = 'bandage',
        category = 'Medical',
        description = 'Used to stop bleeding and restore a small amount of health.',
        time = 5,
        level = 1,
        exp = 10,
        recipe = {
            {itemName = 'clothe', count = 5},            
        },
    },
    ['pistol'] = {
        itemName = 'weapon_pistol',
        category = 'Weapon',
        description = 'Used for basic self‑defense, offering moderate damage at close range.',
        time = 20,
        level = 3,
        exp = 50,
        recipe = {
            {itemName = 'copper', count = 5},
            {itemName = 'iron', count = 5},                   
        },
        tools = {
            {itemName = 'blueprint', count = 1},            
        },
    },
    ['t20'] = {
        itemName = 't20',
        label = 'T20',
        type = 'car',
        category = 'Vehicle',
        stats = {
            {icon = 'material-symbols:speed', label = 'Speed', value = '200 km/h', color = 'rgb(58, 196, 127)'},
        },
        time = 10,
        level = 5,
        recipe = {
            {itemName = 'iron', count = 30},            
        },
        tools = {
            {itemName = 'fixkit', count = 1}
        },
    }
}

return crafts