Installation
Items
Add the following snippet to ox_inventory/data/items.lua
.
ox_inventory/data/items.lua
['gift'] = {
label = 'Gift',
weight = 1,
stack = false,
close = false,
consume = 0,
server = {
export = 'ac_gifts.unwrapGift',
},
},
['empty_gift'] = {
label = 'Gift box',
weight = 1,
stack = false,
close = false,
consume = 0,
buttons = {{
label = 'Wrap gift',
action = function(slot)
TriggerServerEvent('ac_gifts:wrapGift', slot)
end,
}}
},
['opened_gift'] = {
label = 'Opened gift',
weight = 1,
stack = false,
close = false,
consume = 0,
},
Add the following snippet to the bottom of ox_inventory/modules/items/containers.lua
.
ox_inventory/modules/items/containers.lua
setContainerProperties('empty_gift', {
slots = 3,
maxWeight = 5000,
})
For more detailed steps, visit the official Creating items guide.
Images
Obtaining empty gifts
Shop
ox_inventory/data/shops.lua
GiftShop = {
name = 'Gift shop',
inventory = {
{ name = 'empty_gift', price = 1, metadata = { type = 'small' } },
{ name = 'empty_gift', price = 3, metadata = { type = 'medium' } },
{ name = 'empty_gift', price = 5, metadata = { type = 'large' } },
}, locations = {
vec3(1098.5988, -674.4120, 56.4850),
},
},
Inventory
exports.ox_inventory:AddItem(source, 'empty_gift', 1, 'small')
Command
-- [size] = any predefined size (defaults to 'defaultSize' from config)
/giveitem me empty_gift 1 [size]
-- example
/giveitem me empty_gift 1 small