configCraft.lua

config.craft = {}
config.defaultCraftJob = {}
config.defaultCraftGang = {}

config.craftLocations = {
    {
        job = nil,  -- job name or null (delete this line if you want everyone to be able to open it)
        -- job = "police", -- Exmaple for police only
        gang = nil, -- gang name or null (delete this line if you want everyone to be able to open it)
        -- gang = "ballas", -- Example for ballas gang only
        craftName = 'defaultCraft',
        text = {
            tr = "Default Üretim Menüsü",
            en = "Default Crafting Menu",
        },
        maxDistance = 3.0,
        pressDistance = 2.0,
        useTarget = false, -- If you want it to work with target, set it to true and edit the zones section. If not, edit the points section.
        points = {
            vec3(-1147.083008, -2002.662109, 13.180260),
            vec3(-345.374969, -130.687088, 39.009613)
        },
        zones = {
            {
                coords = vec3(-1146.2, -2002.05, 13.2),
                size = vec3(3.8, 1.05, 0.15),
                distance = 1.5,
                rotation = 315.0,
            },
            {
                coords = vec3(-346.1, -130.45, 39.0),
                size = vec3(3.8, 1.05, 0.15),
                distance = 1.5,
                rotation = 70.0,
            },
        },
        blip = {
            active = true,
            sprite = 566,
            scale = 0.8,
            color = 31,
            label = {
                tr = "Default Üretim Menüsü",
                en = "Default Crafting Menu",
            }
        }
    },
}

local function registerCraft(category, label, items)
    assert(type(category) == "string", "Category must be a string")
    assert(type(label) == "string", "Label must be a string")
    assert(type(items) == "table", "Items must be a table")

    config.craft[#config.craft + 1] = {
        category = category,
        label = label,
        items = items
    }
end
exports("RegisterCraft", registerCraft)

local function registerJobCraft(jobName, label, items)
    assert(type(jobName) == "string", "Job name must be a string")
    assert(config.defaultCraftJob[jobName] == nil, ("Job %s already exists in defaultCraftJob").format(jobName))
    assert(type(label) == "string", "Label must be a string")
    assert(type(items) == "table", "Items must be a table")

    config.defaultCraftJob[jobName] = {
        label = label,
        items = items
    }
end
exports("RegisterJobCraft", registerJobCraft)

local function registerGangCraft(gangName, label, items)
    assert(type(gangName) == "string", "Gabg name must be a string")
    assert(config.defaultCraftGang[gangName] == nil, ("Gang %s already exists in defaultCraftGang").format(gangName))
    assert(type(label) == "string", "Label must be a string")
    assert(type(items) == "table", "Items must be a table")

    config.defaultCraftGang[gangName] = {
        label = label,
        items = items
    }
end
exports("RegisterGangCraft", registerGangCraft)

-- Default crafting
registerCraft("defaultCraft", "Main Craft", {
    {
        giveAmount = 1,
        name = 'testburger',
        costs = {
            ['testitem'] = 5,
            ['testitemuniq'] = 3,
        },
        duration = 5000, -- 5 seconds crafting times (optional)
        info = {
            label = "My Test Label for Burger"
        }
    },
    --[[
    {
        giveAmount = 1,
        name = 'lockpick',
        costs = {
            ['metalscrap'] = 22,
            ['plastic'] = 32,
        },
    },
    {
        giveAmount = 1,
        name = 'screwdriverset',
        costs = {
            ['metalscrap'] = 30,
            ['plastic'] = 42,
        },
    },
    {
        giveAmount = 1,
        name = 'electronickit',
        costs = {
            ['metalscrap'] = 30,
            ['plastic'] = 45,
            ['aluminum'] = 28,
        },
    },
    {
        giveAmount = 1,
        name = 'radioscanner',
        costs = {
            ['electronickit'] = 2,
            ['plastic'] = 52,
            ['steel'] = 40,
        },
    },
    {
        giveAmount = 1,
        name = 'gatecrack',
        costs = {
            ['metalscrap'] = 10,
            ['plastic'] = 50,
            ['aluminum'] = 30,
            ['iron'] = 17,
            ['electronickit'] = 2,
        },
    },
    ]]
})

-- Example for police job
registerJobCraft("police", "Police Crafting", {
    {
        giveAmount = 1,
        name = 'handcuffs',
        costs = {
            ['metalscrap'] = 36,
            ['steel'] = 24,
            ['aluminum'] = 28,
        },
    },
    {
        giveAmount = 1,
        name = 'repairkit',
        costs = {
            ['metalscrap'] = 32,
            ['steel'] = 43,
            ['plastic'] = 61,
        },
    },
    {
        giveAmount = 1,
        name = 'pistol_ammo',
        costs = {
            ['metalscrap'] = 50,
            ['steel'] = 37,
            ['copper'] = 26,
        },
    },
    {
        giveAmount = 1,
        name = 'ironoxide',
        costs = {
            ['iron'] = 60,
            ['glass'] = 30,
        },
    },
    {
        giveAmount = 1,
        name = 'aluminumoxide',
        costs = {
            ['aluminum'] = 60,
            ['glass'] = 30,
        },
    },
    {
        giveAmount = 1,
        name = 'armor',
        costs = {
            ['iron'] = 33,
            ['steel'] = 44,
            ['plastic'] = 55,
            ['aluminum'] = 22,
        },
    },
    {
        giveAmount = 1,
        name = 'drill',
        costs = {
            ['iron'] = 50,
            ['steel'] = 50,
            ['screwdriverset'] = 3,
            ['advancedlockpick'] = 2,
        },
    },
})

-- Example for ballas gang
registerGangCraft("ballas", "Ballas Crafting", {
    {
        giveAmount = 1,
        name = 'repairkit',
        costs = {
            ['metalscrap'] = 32,
            ['steel'] = 43,
            ['plastic'] = 61,
        },
    },
})

local craftCategory = {}
for i = 1, #config.craft do
    craftCategory[i] = {
        craft = i,
        label = config.craft[i].label
    }
end

exports("CraftCategory", function()
    return craftCategory
end)

Last updated