new-qb-inventory
You would still need to unstack weedbaggie or weedpackage while selling.
Add Items:
Copy the image files from the
img
folder to yourinventory
folder.Go to qb-core/shared/items.lua
femaleseed = {name = 'femaleseed', label = 'Female Marijuana Seed', weight = 1000, type = 'item', image = 'weed-seed.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'Surely I can just plant this, right?'},
maleseed = {name = 'maleseed', label = 'Male Marijuana Seed', weight = 1000, type = 'item', image = 'weed-seed.png', unique = false, useable = false, shouldClose = false, combinable = nil, description = 'Add this to a planted female seed to make it pregnant? You are pretty sure this seed has a penis.'},
wateringcan = {name = 'wateringcan', label = 'Watering Can', weight = 7000, type = 'item', image = 'wateringcan.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'Fill this at a river or lake.'},
fertilizer = {name = 'fertilizer', label = 'Fertilizer', weight = 1000, type = 'item', image = 'fertilizer.png', unique = false, useable = false, shouldClose = false, combinable = nil, description = 'Cool'},
wetbud = {name = 'wetbud', label = 'Wet Bud (100 grams)', weight = 35000, type = 'item', image = 'wet.png', unique = true, useable = false, shouldClose = false, combinable = nil, description = 'THIS CANT BE DRIED WITHOUT STRAIN... Needs to be stored somewhere dry.'},
driedbud = {name = 'driedbud', label = 'Dried Bud (100 Grams)', weight = 10000, type = 'item', image = 'driedbud.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'Pack It?'},
weedpackage = {name = 'weedpackage', label = 'Suspicious Package', weight = 25000, type = 'item', image = 'weedpackage.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'Marked for Police Seizure'},
qualityscales = {name = 'qualityscales', label = 'High a', weight = 2000, type = 'item', image = 'qualityscales.png', unique = true, useable = false, shouldClose = false, combinable = nil, description = 'Weighs Baggies with no loss'},
smallscales = {name = 'smallscales', label = 'Small Scales', weight = 1000, type = 'item', image = 'smallscales.png', unique = true, useable = false, shouldClose = false, combinable = nil, description = 'Weighs Baggies with minimal loss'},
emptybaggies = {name = 'emptybaggies', label = 'Empty Baggies', weight = 1000, type = 'item', image = 'emptybaggies.png', unique = false, useable = false, shouldClose = false, combinable = nil, description = 'Empty Baggies'},
joint = {name = 'joint', label = '2g Joint', weight = 1000, type = 'item', image = 'joint.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'Its a Joint, man.'},
weedbaggie = {name = 'weedbaggie', label = 'Baggie (7g)', weight = 1000, type = 'item', image = 'weedbaggie.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'Sold on the streets'},
rollingpaper = {name = 'rollingpaper', label = 'Rolling Paper', weight = 2000, type = 'item', image = 'rollingpaper.png', unique = false, useable = false, shouldClose = false, combinable = nil, description = 'Required to roll joints!'},
Dry:
Step 1:
Go to your qb-inventory/server/function.lua
Search for the following code:
TriggerClientEvent('qb-inventory:client:openInventory', source, QBPlayer.PlayerData.items, formattedInventory)
Add the following code BEFORE the whole event:
TriggerEvent('rep-weed:server:checkDry', source, QBPlayer.PlayerData.items, formattedInventory)
Step 2:
Search for the following code:
AddEventHandler('txAdmin:events:serverShuttingDown', function()
for inventory, data in pairs(Inventories) do
if data.isOpen then
MySQL.prepare('INSERT INTO inventories (identifier, items) VALUES (?, ?) ON DUPLICATE KEY UPDATE items = ?', { inventory, json.encode(data.items), json.encode(data.items) })
end
end
end)
Add this AFTER that line:
RegisterNetEvent('rep-weed:server:updateDry',function (name, slot, item)
Inventories[name].items[slot] = item
end)
RegisterNetEvent('rep-weed:server:saveDry',function (name)
if Inventories[name].isOpen then
MySQL.prepare('INSERT INTO inventories (identifier, items) VALUES (?, ?) ON DUPLICATE KEY UPDATE items = ?', {
name, json.encode(Inventories[name].items), json.encode(Inventories[name].items)
})
end
end)
Step 3:
Go to your qb-inventory/server/functions.lua
Search for the following code:
amount = tonumber(amount) or 1
Add this AFTER that line:
if item == "wetbud" and type(identifier) == "string" and identifier:find('stash-') then
if not info then
info = {}
info.time = os.time()
info.dry = 0
else
if not info.time then info.time = os.time() end
if not info.dry then info.dry = 0 end
end
end
(OPTIONAL) If you want weed to also dry in trunk, player or glove trunk, repeat the same process
Give Item with metadata:
Go to your inventory-file/server/main.lua
Search for the following code:
elseif itemData["name"] == "harness" then
info.uses = 20
Add this AFTER that line:
elseif itemData["name"] == "driedbud" then
info.strain = "Unknown"
info.n = 0
info.p = 0
info.k = 0
info.remainweight = 100
elseif itemData["name"] == "weedpackage" then
info.strain = "Unknown"
info.n = 1
info.p = 1
info.k = 1
info.remainweight = 100
elseif itemData["name"] == "weedbaggie" then
info.strain = "Unknown"
info.n = 0
info.p = 0
info.k = 0
elseif itemData["name"] == "wetbud" then
info.strain = "Unknown"
info.n = 0
info.p = 0
info.k = 0
info.dry = 0
elseif itemData["name"] == "joint" then
info.strain = "Unknown"
info.dry = 0
info.n = 0
info.p = 0
info.k = 0
elseif itemData["name"] == "maleseed" then
info.strain = "Unknown"
info.n = 0
info.p = 0
info.k = 0
elseif itemData["name"] == "Unknown" then
info.water = 0
Last updated