It’s useless, since you can do it directly from the inventory…
ox_inventory/data/items.lua
Create item
['ammobox-9'] = {
label = 'Ammo Box 9mm',
stack = true,
client = {
usetime = 2500,
},
allowArmed = true
},
ox_inventory/modules/items/server.lua
Go line 361 (Serverside item functions)
Create event
Item('ammobox-9', function(event, item, inventory, slot, data)
if event == 'usedItem' then
Inventory.AddItem(source, 'ammo-9', 50)
end
end)
GG
2 Likes
yes, but it was requested by a lot of people from my discord so I did it to make it the fastest and easiest for people …
figured this out months ago lol
1 Like
Sadpk
April 24, 2024, 1:40pm
5
Thanks exaclty what i search
Sadpk
April 24, 2024, 1:44pm
6
Question for you if is possible ! Can i put multi item to Receive when i open the box ? Like if if open a box of Donut can i put Inventory.AddItem(source, ‘chocolate_donut’ 3 , ‘vanilla_donnut’ 3)
Don’t think you can on the same line due to syntax, but you may be able to just add a line underneath like:
Item('boxdonuts', function(event, item, inventory, slot, data)
if event == 'usedItem' then
Inventory.AddItem(source, 'chocolate_donut', 3),
Inventory.AddItem(source, 'vanilla_donut', 3)
end
end)
Give it a try, let me know, I’d be curious.