[ESX] Ammobox Retex Scripts

:gun: Hello everyone , today there is a new simple script Ammobox

image

:robot: If you need help contact me on discord in README.md in github post

:gun: About

1. If you use the box it will give you a certain number of bullets which you set in server/main.lua

:money_with_wings: TEBEX
:cat: GITHUB
:camera: SHOWCASE

Code is accessible Yes
Subscription-based No
Requirements ox_inventory
Support Yes
2 Likes

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

Thanks exaclty what i search

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.