Item Setup Guide

This guide will help you add the required items to your inventory system. Choose the section that matches your inventory system.

OX-Inventory Setup

Step 1: Add Items to items.lua

  1. Navigate to: ox_inventory/data/items.lua

  2. Add the following items to your items table:

['laser_remover'] = {
    label = 'Laser Remover',
    weight = 1000,
    client = { image = 'laser_remover.png' },
},

['laser_device'] = {
    label = 'Self Security Laser',
    weight = 1000,
    client = { image = 'laser_device.png' },
},

['laser_devicepol'] = {
    label = 'Police Security Laser',
    weight = 1000,
    client = { image = 'laser_device.png' },
},

Step 2: Add Item Images

  1. Navigate to: ox_inventory/web/images/

  2. Add the following image files:

    • laser_remover.png

    • laser_device.png

    • laser_devicepol.png (can use the same image as laser_device.png)

Note: Image dimensions should be 512x512 pixels for best quality.

Step 3: Add Item Usage Handlers

  1. Navigate to: ox_inventory/modules/items/client.lua

  2. Add the following code at the end of the file:

Step 4: Restart Resource

After adding the items, restart your ox_inventory resource:


QB-Inventory Setup

Step 1: Add Items to items.lua

  1. Navigate to: qb-inventory/shared/items.lua

  2. Add the following items to your items table:

Step 2: Add Item Images

  1. Navigate to: qb-inventory/html/images/

  2. Add the following image files:

    • laser_remover.png

    • laser_device.png

    • laser_devicepol.png (can use the same image as laser_device.png)

Note: Image dimensions should be 512x512 pixels for best quality.

Step 3: No Additional Code Required

QB-Inventory automatically handles item usage through the CreateUseableItem function in the laser system's server script. No additional client-side code is needed.

Step 4: Restart Resource

After adding the items, restart your qb-inventory resource:


Item Descriptions

laser_device

  • Label: Self Security Laser (or Laser Device)

  • Description: A laser device that allows players to place security laser tripwires. When triggered, it notifies the owner.

  • Usage: Use the item to enter laser placement mode.

laser_devicepol

  • Label: Police Security Laser

  • Description: A police-only laser device. When triggered, it notifies all on-duty police officers in addition to the owner.

  • Usage: Use the item to enter laser placement mode (police version).

laser_remover

  • Label: Laser Remover

  • Description: A device that removes the closest laser to your position.

  • Usage: Use the item to remove the nearest laser.


Customizing Item Properties

You can customize the following properties for each item:

  • label: Display name shown in inventory

  • weight: Item weight (affects inventory capacity)

  • description: Item description shown in tooltips

  • image: Image file name (must match the file in images folder)

Example Customization


Troubleshooting

Items Not Showing in Inventory

  1. Verify the item names match exactly (case-sensitive)

  2. Check that images are in the correct folder

  3. Ensure the resource has been restarted

  4. Check server console for any errors

Items Not Working When Used

  1. For OX-Inventory: Verify the item handlers are added to client.lua

  2. For QB-Inventory: Check that the server script is properly loaded

  3. Verify the framework and inventory settings in shared/config.lua

  4. Check server console for error messages

Images Not Displaying

  1. Verify image files are in the correct directory

  2. Check file names match exactly (including extension)

  3. Ensure images are in PNG format

  4. Verify image dimensions are appropriate (512x512 recommended)


Items setup complete! Players can now purchase and use laser devices.

Last updated