Hey there,
Yorzen here with a quick & easy tutorial for adding items into your server. [QBCore framework]
Things you will need:
100x100px .png file of your desired item.
Access to the FTP Server. (can be used locally)
Patience and a functioning brain
Copy & Paste skills (Itās NOT a joke, while dealing with huge files such as items.lua be careful)
- Open /resources/[qb]/qb-core/shared/items.lua (MAKE BACKUP BEFORE EDITING!)
- Add the correct line of code of a similar item (copy & paste similar line of code) edit the item details such as weight, description and so onā¦ then save changes.
- Drag & Drop the filename.png into /resources/[qb]/qb-inventory/html/images folder.
FILENAME SHOULD BE IDENTICAL TO THE NAME IN THE CODE! - Add thirst and hunger values for drinks and food go to /resources/[qb]/qb-smallresources/config.lua MAKE BACKUP BEFORE EDITING!
- Go to /resources/[qb]/qb-smallresources/server/consumables.lua and copy and edit this example code:
QBCore.Functions.CreateUseableItem("sandwich", function(source, item)
local Player = QBCore.Functions.GetPlayer(source)
if Player.Functions.RemoveItem(item.name, 1, item.slot) then
TriggerClientEvent("consumables:client:Eat", source, item.name)
end
end)
- Rename āsandwichā to your desired item name If consumable and save changes.
Optional - Add an item to shop / gas station / hardwarestore etcā¦:
- Make sure the item is properly added to the server both in items.lua file & images folder.
- Go to /resources/[qb]/qb-shops/config.lua and edit as shown below (example):
(MAKE BACKUP BEFORE EDITING!)
[14] = {
name = "clipper420",
price = 10,
amount = 420,
info = {},
type = "item",
slot = 14,
},
Important notes: The Item Number [ ] in config.lua must be incremented by +1 *Last item on the list copy and paste and change both [x] and slot = x increase by +1 (Example: [14] turns to [15])
Important: .png file resolution must be 100 x 100px
Important: Edit values of Weight, Price, Description etcā¦
Verify and save all config files and restart the server to see the changes.
If youāre still struggling let me know down in the comments Iāll do my best to simplify it a little more.
P.S Iāve tried to look for a tutorial and didnāt find any of this topic thought it could help some of you out there
Visit our server Harmony RP|18+|Discord|Global / Cfx.re (click to join)
Discord: ššŖš»š¶šøš·š š”š | 18+š
Peace,
Yorzen