[Release] Safety deposit box [update for job]

Can someone help me. Im trying to get this to work but i got a F8 console error -> https://gyazo.com/b09dcb4fb31239a2f2537db72e731283

I did everything in the readme.

This happens when i try to switch a item from my inv too the vault.

When i open my inventory im not able to open the vault anymore. So when i join the server and open the vault it will show the vault section but when i open my inventory and then again open thhe vault it just looks like a normal inventory without the vault section.

could you share a snippit?

cannot store black money

If I store 10.000 black money (or other number) then I see the 10.000 is gone out my inventory but not in the safe visible… also no message that the blackmoney is in the safe

Hello I have this error when I put the trunk and I remove an item in the police trunk with the job or ambulance with the job

remove item error server/main/lua:19 attempt to compare nil with number

https://gyazo.com/7899ae5003411fbc3c2eb99f37ded60f
and look this https://gyazo.com/c8a6460d1ff441e2b223b41c8a768cb7

1 Like

@ineokb Are you using weight as limit? I have a solution if so.

could you show it?

@CaptnSloth

managed to get it to work with the new extended https://gyazo.com/ab15a3a1c25bb9e0ec4b9094110a0373

Can confirm that fixed the “attempt to compare number with nil error” for me.
Replace:

		if xPlayer.job.name == job then
			TriggerEvent('esx_addoninventory:getSharedInventory', 'society_'..job, function(inventory)
				local inventoryItem = inventory.getItem(item)
				if count > 0 and inventoryItem.count >= count then
					if sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then
						print('notify: player cannot hold')
						TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('player_cannot_hold'), length = 5500})
					else
						inventory.removeItem(item, count)
						xPlayer.addInventoryItem(item, count)
						TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_withdrawn', count, inventoryItem.label), length = 7500})
					end
				else
					print('not enough in vault')
					TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('not_enough_in_vault'), length = 5500})
				end
			end)

With:

if xPlayer.job.name == job then
			TriggerEvent('esx_addoninventory:getSharedInventory', 'society_'..job, function(inventory)
				local inventoryItem = inventory.getItem(item)
				if count > 0 and inventoryItem.count >= count then
					if item.weight ~= -1 then
						inventory.removeItem(item, count)
						xPlayer.addInventoryItem(item, count)
						TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_withdrawn', count, inventoryItem.label), length = 7500})
					end
				else
					print('not enough in vault')
					TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('not_enough_in_vault'), length = 5500})
				end
			end)

You also need to do the same to vault:

Change this:

		elseif job == 'vault' then
			TriggerEvent('esx_addoninventory:getInventory', 'vault', xPlayerOwner.identifier, function(inventory)
				local inventoryItem = inventory.getItem(item)
	
				
				if count > 0 and inventoryItem.count >= count then
					if sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then
						TriggerClientEvent('mythic_notify:client:SendAlert', _source,  {type = 'error', text = _U('player_cannot_hold'), length = 5500})
					else
						inventory.removeItem(item, count)
						xPlayer.addInventoryItem(item, count)
						TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_withdrawn', count, inventoryItem.label), length = 8500})
					end
				else
					TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('not_enough_in_vault'), length = 5500})
				end
			end)
		else
			print('notify: not permission for this job')
		end

To This:

		elseif job == 'vault' then
			TriggerEvent('esx_addoninventory:getInventory', 'vault', xPlayerOwner.identifier, function(inventory)
				local inventoryItem = inventory.getItem(item)
	
				
				if count > 0 and inventoryItem.count >= count then
					if item.weight ~= -1 then
						inventory.removeItem(item, count)
						xPlayer.addInventoryItem(item, count)
						TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_withdrawn', count, inventoryItem.label), length = 7500})
					end
				else
					TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('not_enough_in_vault'), length = 5500})
				end
			end)
		else
			print('notify: not permission for this job')
		end
5 Likes

server.lua

if xPlayer.job.name == job then

        TriggerEvent('esx_addoninventory:getSharedInventory', 'society_'..job, function(inventory)

            local inventoryItem = inventory.getItem(item)

            if count > 0 and inventoryItem.count >= count then

                if xPlayerOwner.canCarryItem(item, count) then

                    inventory.removeItem(item, count)

                    xPlayer.addInventoryItem(item, count)

                    TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_withdrawn', count, inventoryItem.label), length = 7500})

                end

            else

                print('not enough in vault')

                TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('not_enough_in_vault'), length = 5500})

            end

        end)

hello can you send the inventory hud i don’t find one

what is this error help me pls

i got an issues with this script, this vault inventory cant refresh what i can do for refresh this?
@ShinxD

Thankss for this it works for me also… :slight_smile:

1 Like

is it posible to add an aditional vault with other item?

how can i put and remove black money other than police

2020-09-02 21-03-54.mkv (10.7 MB) hy. what can i made with this?

Hey is it possible to give every player his own private deposit box?

Its literally on the script lol, just add coords as a “vault” and thats it.

could anyone send me the working version? I can’t load or unload objects. I don’t understand the fix