Create the Shield Item for ox_inventory
This guide explains how to create and configure the Shield item for ox_inventory.
1. Get the name of the shield item
In r_shields, open:
r_shields/config.lua
Retrieve each name one by one from the shields listed in the script's configuration, by default, there will be three models:
ballistic_shield
prop_ballistic_shield
wheel_shield
In our example, we'll use the first one (ballistic_shield) but you'll need to repeat this process for all the shields on your list.
2. Create the item in ox_inventory/data/items.lua
Open:
ox_inventory/data/items.lua
Add this item definition:
['ballistic_shield'] = {
label = 'Ballistic Shield',
weight = 10000, -- Set a weight that is consistent with your shield's design
stack = false,
consume = 0,
client = {
event = 'r_shields:client:useShield'
}
},What each value means
label: Display name shown in the inventory
weight: Item weight (example:
10000= 10kg)stack = false: Prevents stacking multiple shield in one slot (recommended)
consume = 0: The item is not consumed on use
client.event: Calls the client event
r_shields:client:useShieldwhen using the item
3. Add the Shield image
ox_inventory loads item images from:
You already have the icon here:
Copy it to:
Last updated