[Release] [ESX] Custom Storage

This ESX script allows you to place storage at any coordinate you want! The script will draw a marker and allow you to deposit / withdraw objects

Support will not be provided. I am using es_extended V1 final (1.2)

Github

8 Likes

what versions of es_exteneded?

V1 Final

1 Like

the SQL doesnt open anything for me ?!

1 Like

Had one other report that the SQL wasn’t working properly, I’m not entirely sure why. For the time being, it goes into the addon_inventory table if you would like to manually add it. Sorry!

1 Like

oh its just to add the societys on the addon inventory ?! thats easy then ty

PS: nevermind u have it write on the readme!

Thanks for this awesome to create storages have already adapted it to use bt-target working perfectly ty <3 !

1 Like

do you share your version on bt-target?

1 Like

This doesn’t use bt-target but you could easily concert it by adding an event to open the menus rather than using the key press inside the markers!

is there a possible way to add the ability to store weapons and dirty money?

1 Like

As of now, this is items only!

hey Abel! Nice Script!
is it possible to make this only useable with a specific job? Ive tried it a couple times, but wasnt successfull!

1 Like

It would be possible if you ran a job check in the server callback for import/export I would assume.

These code lines are untested, but would go in the server/main.lua (replacing these existing functions)

ESX.RegisterServerCallback('esx_CustomStorage:getStockItems', function(source, cb, storageName)
	local xPlayer = ESX.GetPlayerFromId(source)
	if Config.ServerPrint then
		print('Getting items from: ' .. storageName)
	end
	if xPlayer.getJob().name== 'police' then
		TriggerEvent('esx_addoninventory:getSharedInventory', storageName, function(inventory)
			cb(inventory.items)
		end)
	end
end)
RegisterNetEvent('esx_CustomStorage:putStockItems')
AddEventHandler('esx_CustomStorage:putStockItems', function(itemName, count, storageName)
	local xPlayer = ESX.GetPlayerFromId(source)
	local sourceItem = xPlayer.getInventoryItem(itemName)

	if xPlayer.getJob().name== 'police' then
		TriggerEvent('esx_addoninventory:getSharedInventory', storageName, function(inventory)
			local inventoryItem = xPlayer.getInventoryItem(itemName)
	
			-- does the player have enough of the item?
			if sourceItem.count >= count and count > 0 then
				xPlayer.removeInventoryItem(itemName, count)
				inventory.addItem(itemName, count)
				xPlayer.showNotification('You have deposited ~b~' .. count .. ' ~y~' .. inventoryItem.label)
			else
				xPlayer.showNotification('Invalid Amount')
			end
		end)
	end
end)
RegisterNetEvent('esx_CustomStorage:getStockItem')
AddEventHandler('esx_CustomStorage:getStockItem', function(itemName, count, storageName)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)

	if xPlayer.getJob().name== 'police' then
		TriggerEvent('esx_addoninventory:getSharedInventory', storageName, function(inventory)
			local inventoryItem = inventory.getItem(itemName)
	
			
			-- is there enough in the society?
			if count > 0 and inventoryItem.count >= count then
				if xPlayer.canCarryItem(itemName, count) then
					inventory.removeItem(itemName, count)
					xPlayer.addInventoryItem(itemName, count)
					xPlayer.showNotification('You have withdrawn ~b~' .. count .. ' ~y~ ' .. inventoryItem.label)
				else
					xPlayer.showNotification('~r~Invalid Amount')
				end
			else
				xPlayer.showNotification('~r~Invalid Amount')
			end
		end)
	end
end)
2 Likes

Hello, thanks for the script I would have a question it would be possible to add the possibility of depositing black money ?

1 Like

At the time I don’t have any intentions to add this!

Thanks for the share :wink:

Someone have an idea on how to not show items that has 0 in the storage ?

If i pull out objects, the label still remain in :

Ex : 0x Water

Thanks a lot for the help :wink:

Why when I try to deposit something even if I have billion of items I can’t get any of them on the list to deposit?

Why can’t I get something from the warehouse

For do it personal / owned?