How to add items

To add a new item to your FiveM server, you need to modify specific files based on the inventory system you’re using. These files are located in the [items] directory within your script. Follow the instructions below based on your inventory system.

QB Core and QB-Inventory

If you’re using qb-core and qb-inventory, you need to edit the qb-core/shared/items.lua file.

Steps to Modify:

  • Locate the [items] Directory:

    • Connect to your server files via FTP or file manager.

    • Navigate to the qb-core resource directory and find the qb-core/shared/items.lua.

  • Add item initems.lua:

    • Use a text editor to open the items.lua file.

    • Copy a line from the items you have already created or copy the following example and modify it with the correct data of the item you want to create:

      cheesecake    = { name = 'cheesecake', label = 'Cheesecake', weight = 200, type = 'item', image = 'cheesecake.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = 'A sweet cheesecake' },
    • Save the file

  • Add the image

    • Save the image in .png format and a size of 100px by 100px in the folder qb-inventory/html/images folder. The name of the image must be the same as the name you put in the line you added earlier in items.lua You can get images on our website: https://items.bit-code.dev/

  • Restart:

    • Restart your server.

OX_Inventory

If you’re using ox_inventory, you need to modify the ox_inventory/data/items.lua file.

Steps to Modify:

  • Locate the [items] Directory:

    • Connect to your server files via FTP or file manager.

    • Navigate to the ox_inventory resource directory and find the ox_inventory/data/items.lua.

  • Add Your Item:

    • Find the section where items are defined and use the appropriate method to register your new item.

  • Save and Restart:

    • Save the items.lua file and restart your server.

ESX Inventory

If you’re using esx inventory, you’ll need to update the items table in your database.

Steps to Modify:

  • Locate the [items] table:

    • Connect to your server’s database management tool (e.g., phpMyAdmin, HeidiSQL..) and find the items table.

  • Edit:

    • Inside the items table, add a new line with the data of the item you want to create.

  • Apply Changes:

    • Save the changes

  • Restart Your Server:

    • Restart your server to ensure the new item is available.

QS_Inventory

If you’re using qs_inventory:

Steps to Modify:

  • Locate the [items] Directory:

    • Connect to your server files via FTP or file manager.

    • Navigate to the qs_inventory resource directory and find the qs_inventory/shared/items.lua.

  • Add item initems.lua:

    • Use a text editor to open the items.lua file.

    • Copy a line from the items you have already created or copy the following example and modify it with the correct data of the item you want to create:

      ['water_bottle'] = {
          name = 'water_bottle',
          label = 'Water Bottle',
          weight = 500,
          type = 'item',
          image = 'water_bottle.png',
          unique = false,
          useable = true,
          shouldClose = true,
          description = 'A refreshing bottle of water.'
      }
    • Save the file

  • Add the image

    • Save the image in .png format and a size of 100px by 100px in the folder qs_inventory/html/images folder. The name of the image must be the same as the name you put in the line you added earlier in items.lua You can get images on our website: https://items.bit-code.dev/

  • Restart:

    • Restart your server.

Verifying your changes

  • Test the New Item:

    • Verify in-game that the new item appears and functions as expected.

  • Check Inventory System:

    • Ensure the item is properly integrated into your inventory system and is visible in the correct sections.

Troubleshooting

  • Item Not Showing Up: Check for syntax errors and confirm that the server has been restarted.

  • Errors in Console: Review server logs for any error messages related to item addition.

Additional Tips

  • Backup Files: Always backup the original files before making changes.

  • Consult Documentation: Refer to the documentation for your specific inventory system for additional guidance and best practices.

Last updated