Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 37 additions & 29 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,22 @@ local function openAnim()
end

local function ItemsToItemInfo()
itemInfos = {
[1] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 22x, " ..QBCore.Shared.Items["plastic"]["label"] .. ": 32x."},
[2] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 30x, " ..QBCore.Shared.Items["plastic"]["label"] .. ": 42x."},
[3] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 30x, " ..QBCore.Shared.Items["plastic"]["label"] .. ": 45x, "..QBCore.Shared.Items["aluminum"]["label"] .. ": 28x."},
[4] = {costs = QBCore.Shared.Items["electronickit"]["label"] .. ": 2x, " ..QBCore.Shared.Items["plastic"]["label"] .. ": 52x, "..QBCore.Shared.Items["steel"]["label"] .. ": 40x."},
[5] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 10x, " ..QBCore.Shared.Items["plastic"]["label"] .. ": 50x, "..QBCore.Shared.Items["aluminum"]["label"] .. ": 30x, "..QBCore.Shared.Items["iron"]["label"] .. ": 17x, "..QBCore.Shared.Items["electronickit"]["label"] .. ": 1x."},
[6] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 36x, " ..QBCore.Shared.Items["steel"]["label"] .. ": 24x, "..QBCore.Shared.Items["aluminum"]["label"] .. ": 28x."},
[7] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 32x, " ..QBCore.Shared.Items["steel"]["label"] .. ": 43x, "..QBCore.Shared.Items["plastic"]["label"] .. ": 61x."},
[8] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 50x, " ..QBCore.Shared.Items["steel"]["label"] .. ": 37x, "..QBCore.Shared.Items["copper"]["label"] .. ": 26x."},
[9] = {costs = QBCore.Shared.Items["iron"]["label"] .. ": 60x, " ..QBCore.Shared.Items["glass"]["label"] .. ": 30x."},
[10] = {costs = QBCore.Shared.Items["aluminum"]["label"] .. ": 60x, " ..QBCore.Shared.Items["glass"]["label"] .. ": 30x."},
[11] = {costs = QBCore.Shared.Items["iron"]["label"] .. ": 33x, " ..QBCore.Shared.Items["steel"]["label"] .. ": 44x, "..QBCore.Shared.Items["plastic"]["label"] .. ": 55x, "..QBCore.Shared.Items["aluminum"]["label"] .. ": 22x."},
[12] = {costs = QBCore.Shared.Items["iron"]["label"] .. ": 50x, " ..QBCore.Shared.Items["steel"]["label"] .. ": 50x, "..QBCore.Shared.Items["screwdriverset"]["label"] .. ": 3x, "..QBCore.Shared.Items["advancedlockpick"]["label"] .. ": 2x."},
}
local item_count = 0
for _, _ in pairs(Config.CraftingItems) do
item_count = item_count + 1
end

local itemInfos = {}

for i = 1, item_count do
local ex_string = ""

for key, value in pairs(Config.CraftingItems[i].costs) do
ex_string = ex_string .. QBCore.Shared.Items[key]["label"] .. ": " .. value .. "x "
end

itemInfos[i] = { costs = ex_string }
end

local items = {}
for _, item in pairs(Config.CraftingItems) do
Expand All @@ -223,19 +225,25 @@ local function ItemsToItemInfo()
end

local function SetupAttachmentItemsInfo()
itemInfos = {
[1] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 140x, " .. QBCore.Shared.Items["steel"]["label"] .. ": 250x, " .. QBCore.Shared.Items["rubber"]["label"] .. ": 60x"},
[2] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 165x, " .. QBCore.Shared.Items["steel"]["label"] .. ": 285x, " .. QBCore.Shared.Items["rubber"]["label"] .. ": 75x"},
[3] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 190x, " .. QBCore.Shared.Items["steel"]["label"] .. ": 305x, " .. QBCore.Shared.Items["rubber"]["label"] .. ": 85x, " .. QBCore.Shared.Items["smg_extendedclip"]["label"] .. ": 1x"},
[4] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 205x, " .. QBCore.Shared.Items["steel"]["label"] .. ": 340x, " .. QBCore.Shared.Items["rubber"]["label"] .. ": 110x, " .. QBCore.Shared.Items["smg_extendedclip"]["label"] .. ": 2x"},
[5] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 230x, " .. QBCore.Shared.Items["steel"]["label"] .. ": 365x, " .. QBCore.Shared.Items["rubber"]["label"] .. ": 130x"},
[6] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 255x, " .. QBCore.Shared.Items["steel"]["label"] .. ": 390x, " .. QBCore.Shared.Items["rubber"]["label"] .. ": 145x"},
[7] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 270x, " .. QBCore.Shared.Items["steel"]["label"] .. ": 435x, " .. QBCore.Shared.Items["rubber"]["label"] .. ": 155x"},
[8] = {costs = QBCore.Shared.Items["metalscrap"]["label"] .. ": 300x, " .. QBCore.Shared.Items["steel"]["label"] .. ": 469x, " .. QBCore.Shared.Items["rubber"]["label"] .. ": 170x"},
}
local item_count = 0
for _, _ in pairs(Config.AttachmentCrafting) do
item_count = item_count + 1
end

local itemInfos = {}

for i = 1, item_count do
local ex_string = ""

for key, value in pairs(Config.AttachmentCrafting[i].costs) do
ex_string = ex_string .. QBCore.Shared.Items[key]["label"] .. ": " .. value .. "x "
end

itemInfos[i] = { costs = ex_string }
end

local items = {}
for _, item in pairs(Config.AttachmentCrafting["items"]) do
for _, item in pairs(Config.AttachmentCrafting) do
local itemInfo = QBCore.Shared.Items[item.name:lower()]
items[item.slot] = {
name = itemInfo["name"],
Expand All @@ -253,7 +261,7 @@ local function SetupAttachmentItemsInfo()
points = item.points,
}
end
Config.AttachmentCrafting["items"] = items
Config.AttachmentCrafting = items
end


Expand All @@ -272,9 +280,9 @@ end
local function GetAttachmentThresholdItems()
SetupAttachmentItemsInfo()
local items = {}
for k in pairs(Config.AttachmentCrafting["items"]) do
if PlayerData.metadata["attachmentcraftingrep"] >= Config.AttachmentCrafting["items"][k].threshold then
items[k] = Config.AttachmentCrafting["items"][k]
for k in pairs(Config.AttachmentCrafting) do
if PlayerData.metadata["attachmentcraftingrep"] >= Config.AttachmentCrafting[k].threshold then
items[k] = Config.AttachmentCrafting[k]
end
end
return items
Expand Down
214 changes: 106 additions & 108 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,122 +221,120 @@ Config.CraftingItems = {
Config.AttachmentCraftingLocation = vector3(88.91, 3743.88, 40.77) -- Only needed if not using target

Config.AttachmentCrafting = {
["items"] = {
[1] = {
name = "pistol_extendedclip",
amount = 50,
info = {},
costs = {
["metalscrap"] = 140,
["steel"] = 250,
["rubber"] = 60,
},
type = "item",
slot = 1,
threshold = 0,
points = 1,
[1] = {
name = "pistol_extendedclip",
amount = 50,
info = {},
costs = {
["metalscrap"] = 140,
["steel"] = 250,
["rubber"] = 60,
},
[2] = {
name = "pistol_suppressor",
amount = 50,
info = {},
costs = {
["metalscrap"] = 165,
["steel"] = 285,
["rubber"] = 75,
},
type = "item",
slot = 2,
threshold = 10,
points = 2,
type = "item",
slot = 1,
threshold = 0,
points = 1,
},
[2] = {
name = "pistol_suppressor",
amount = 50,
info = {},
costs = {
["metalscrap"] = 165,
["steel"] = 285,
["rubber"] = 75,
},
[3] = {
name = "smg_extendedclip",
amount = 50,
info = {},
costs = {
["metalscrap"] = 190,
["steel"] = 305,
["rubber"] = 85,
},
type = "item",
slot = 3,
threshold = 25,
points = 3,
type = "item",
slot = 2,
threshold = 10,
points = 2,
},
[3] = {
name = "smg_extendedclip",
amount = 50,
info = {},
costs = {
["metalscrap"] = 190,
["steel"] = 305,
["rubber"] = 85,
},
[4] = {
name = "microsmg_extendedclip",
amount = 50,
info = {},
costs = {
["metalscrap"] = 205,
["steel"] = 340,
["rubber"] = 110,
},
type = "item",
slot = 4,
threshold = 50,
points = 4,
type = "item",
slot = 3,
threshold = 25,
points = 3,
},
[4] = {
name = "microsmg_extendedclip",
amount = 50,
info = {},
costs = {
["metalscrap"] = 205,
["steel"] = 340,
["rubber"] = 110,
},
[5] = {
name = "smg_drum",
amount = 50,
info = {},
costs = {
["metalscrap"] = 230,
["steel"] = 365,
["rubber"] = 130,
},
type = "item",
slot = 5,
threshold = 75,
points = 5,
type = "item",
slot = 4,
threshold = 50,
points = 4,
},
[5] = {
name = "smg_drum",
amount = 50,
info = {},
costs = {
["metalscrap"] = 230,
["steel"] = 365,
["rubber"] = 130,
},
[6] = {
name = "smg_scope",
amount = 50,
info = {},
costs = {
["metalscrap"] = 255,
["steel"] = 390,
["rubber"] = 145,
},
type = "item",
slot = 6,
threshold = 100,
points = 6,
type = "item",
slot = 5,
threshold = 75,
points = 5,
},
[6] = {
name = "smg_scope",
amount = 50,
info = {},
costs = {
["metalscrap"] = 255,
["steel"] = 390,
["rubber"] = 145,
},
[7] = {
name = "assaultrifle_extendedclip",
amount = 50,
info = {},
costs = {
["metalscrap"] = 270,
["steel"] = 435,
["rubber"] = 155,
["smg_extendedclip"] = 1,
},
type = "item",
slot = 7,
threshold = 150,
points = 7,
type = "item",
slot = 6,
threshold = 100,
points = 6,
},
[7] = {
name = "assaultrifle_extendedclip",
amount = 50,
info = {},
costs = {
["metalscrap"] = 270,
["steel"] = 435,
["rubber"] = 155,
["smg_extendedclip"] = 1,
},
[8] = {
name = "assaultrifle_drum",
amount = 50,
info = {},
costs = {
["metalscrap"] = 300,
["steel"] = 469,
["rubber"] = 170,
["smg_extendedclip"] = 2,
},
type = "item",
slot = 8,
threshold = 200,
points = 8,
type = "item",
slot = 7,
threshold = 150,
points = 7,
},
[8] = {
name = "assaultrifle_drum",
amount = 50,
info = {},
costs = {
["metalscrap"] = 300,
["steel"] = 469,
["rubber"] = 170,
["smg_extendedclip"] = 2,
},
}
type = "item",
slot = 8,
threshold = 200,
points = 8,
},
}

BackEngineVehicles = {
Expand Down
2 changes: 1 addition & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ RegisterNetEvent('inventory:server:SetInventoryData', function(fromInventory, to
TriggerClientEvent('QBCore:Notify', src, "You don't have the right items..", "error")
end
elseif fromInventory == "attachment_crafting" then
local itemData = Config.AttachmentCrafting["items"][fromSlot]
local itemData = Config.AttachmentCrafting[fromSlot]
if hasCraftItems(src, itemData.costs, fromAmount) then
TriggerClientEvent("inventory:client:CraftAttachment", src, itemData.name, itemData.costs, fromAmount, toSlot, itemData.points)
else
Expand Down