[QB/ESX] Adding quasar inventory crafting in Base Building
This snippet will help you setup crafting from quasar inventory as events to use on other scripts like hrs_base_building
In qs-inventory
qs-inventory\(any open client file).lua
In this code I created 3 types of crafting tables as an example, you can create the ones you want and choose the craftings you want
Config.craftingType = {
['med_table'] = {
[1] = {
name = "weapon_carbinerifle",
amount = 1,
info = {},
costs = {
["tosti"] = 1,
},
type = "weapon",
slot = 1,
threshold = 0,
points = 1,
time = 5000,
rep = 'attachmentcraftingrep',
chance = 100
},
[2] = {
name = "tosti",
amount = 1,
info = {},
costs = {
["weapon_carbinerifle"] = 1,
},
type = "item",
slot = 2,
threshold = 0,
points = 1,
time = 5000,
rep = 'attachmentcraftingrep',
chance = 100
},
},
['weapon_table'] = {
[1] = {
name = "weapon_carbinerifle",
amount = 1,
info = {},
costs = {
["tosti"] = 1,
},
type = "weapon",
slot = 1,
threshold = 0,
points = 1,
time = 5000,
rep = 'attachmentcraftingrep',
chance = 100
},
[2] = {
name = "tosti",
amount = 1,
info = {},
costs = {
["weapon_carbinerifle"] = 1,
},
type = "item",
slot = 2,
threshold = 0,
points = 1,
time = 5000,
rep = 'attachmentcraftingrep',
chance = 100
},
},
['normal_table'] = {
[1] = {
name = "weapon_carbinerifle",
amount = 1,
info = {},
costs = {
["tosti"] = 1,
},
type = "weapon",
slot = 1,
threshold = 0,
points = 1,
time = 5000,
rep = 'attachmentcraftingrep',
chance = 100
},
[2] = {
name = "tosti",
amount = 1,
info = {},
costs = {
["weapon_carbinerifle"] = 1,
},
type = "item",
slot = 2,
threshold = 0,
points = 1,
time = 5000,
rep = 'attachmentcraftingrep',
chance = 100
},
},
}
function OpenCrafting(tab)
if Config.craftingType[tab] then
local crafting = {
label = 'Craft',
items = exports['qs-inventory']:SetUpCrafing(Config.craftingType[tab])
}
TriggerServerEvent('inventory:server:SetInventoryItems', Config.craftingType[tab])
TriggerServerEvent("inventory:server:OpenInventory", "customcrafting", crafting.label, crafting)
end
end
AddEventHandler('openCraftingTable',function(tab)
OpenCrafting(tab)
end)In hrs_base_building
hrs_base_building\config.lua
Previous[QB] Adding qb-crafting crafting in Base BuildingNext[QB/ESX] Adding ox_inventory crafting in Base Building
Last updated