can anyone tell me how to add another vault?
did you make it work ? want to share ? cause i got weird issue too
Hey guys, I fixed the ammo issue. The installation is the same as the “original”, its just a small fix so you can put pistols and such in and out from the vault, so it has all his ammo.
Download: monster_vault_fix.rar (19.7 KB)
(sorry for my english)
how do i get them out? the command?
Same thing, I can deposit them, they stay there forever which is nice that the items dont get wiped out but there is no way to take them out…no error messages or anything.
great job
how to make player can save their cash money into this vault ? this resource just can save black money only… what must i do ?
where is possible found this Hinventory? how is name?
I have tried Can’t solve the problem
is there a way to add it so only certain job grades can access?
how can i create more than one vault i mean how to create more boxes that everyone can open it , and thanks
sorry for my bad english
if society then
if item.job == 'police' then
TriggerEvent('otrp_addonaccount:getSharedAccount', typeVault..'_black_money', function(account)
blackMoney = account.money
end)
else
blackMoney = 0
end
TriggerEvent('otrp_addoninventory:getSharedInventory', typeVault, function(inventory)
items = inventory.items
end)
TriggerEvent('otrp_datastore:getSharedDataStore', typeVault, function(store)
weapons = store.get('weapons') or {}
end)
cb({
blackMoney = blackMoney,
items = items,
weapons = weapons,
job = item.job
})
else
TriggerEvent('otrp_addonaccount:getAccount', typeVault..'_black_money', xPlayer.identifier, function(account)
blackMoney = account.money
end)
TriggerEvent('otrp_addoninventory:getInventory', typeVault, xPlayer.identifier, function(inventory)
items = inventory.items
end)
TriggerEvent('otrp_datastore:getDataStore', typeVault, xPlayer.identifier, function(store)
weapons = store.get('weapons') or {}
end)
cb({
blackMoney = blackMoney,
items = items,
weapons = weapons,
job = item.job
})
How To Add New Job to blackmoney in my monster vault always error police i can add , another job cannot
I want to add a safe for another job, not just for the police, can I help? what are the examples of addition?
Hi
make it so:
if society then
if item.job == 'police' then
replace with
if society then
if item.job == 'police' or item.job == 'ambulance' or item.job == 'mechanic' then
and so.
Hope i helped you!
Have a nice day!
ESX = nil
TriggerEvent('otrp:getSharedObject', function(obj) ESX = obj end)
RegisterServerEvent('conde_inventory:getItem')
AddEventHandler('conde_inventory:getItem', function(--[[owner,--]] job, type, item, count)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local xPlayerOwner = ESX.GetPlayerFromIdentifier(xPlayer.identifier)
if type == 'item_standard' then
local sourceItem = xPlayer.getInventoryItem(item)
if xPlayer.job.name == job then
TriggerEvent('otrp_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)
elseif job == 'vault' then
TriggerEvent('otrp_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
elseif type == 'item_account' then
if xPlayer.job.name == job then
TriggerEvent('otrp_addonaccount:getSharedAccount', 'society_'..job..'_'..item, function(account)
local policeAccountMoney = account.money
if policeAccountMoney >= count then
account.removeMoney(count)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('amount_invalid'), length = 5500})
end
end)
elseif job == 'vault' then
TriggerEvent('otrp_addonaccount:getAccount', 'vault_' .. item, xPlayerOwner.identifier, function(account)
local roomAccountMoney = account.money
if roomAccountMoney >= count then
account.removeMoney(count)
xPlayer.addAccountMoney(item, count)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('amount_invalid'), length = 5500})
end
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = "You not have permission", length = 5500})
end
elseif type == 'item_weapon' then
if xPlayer.job.name == job then
TriggerEvent('otrp_datastore:getSharedDataStore', 'society_'..job, function(store)
local storeWeapons = store.get('weapons') or {}
local weaponName = nil
local ammo = nil
for i=1, #storeWeapons, 1 do
if storeWeapons[i].name == item then
weaponName = storeWeapons[i].name
ammo = storeWeapons[i].ammo
table.remove(storeWeapons, i)
break
end
end
store.set('weapons', storeWeapons)
xPlayer.addWeapon(weaponName, ammo)
end)
elseif job == 'vault' then
TriggerEvent('otrp_datastore:getDataStore', 'vault', xPlayerOwner.identifier, function(store)
local storeWeapons = store.get('weapons') or {}
local weaponName = nil
local ammo = nil
for i=1, #storeWeapons, 1 do
if storeWeapons[i].name == item then
weaponName = storeWeapons[i].name
ammo = storeWeapons[i].ammo
table.remove(storeWeapons, i)
break
end
end
store.set('weapons', storeWeapons)
xPlayer.addWeapon(weaponName, ammo)
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = 'You not have permission', length = 5500})
end
end
end)
RegisterServerEvent('conde_inventory:putItem')
AddEventHandler('conde_inventory:putItem', function(--[[owner,--]] job, type, item, count)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local xPlayerOwner = ESX.GetPlayerFromIdentifier(xPlayer.identifier)
if type == 'item_standard' then
local playerItemCount = xPlayer.getInventoryItem(item).count
if playerItemCount >= count and count > 0 then
if xPlayer.job.name == job then
TriggerEvent('otrp_addoninventory:getSharedInventory', 'society_'..job, function(inventory)
xPlayer.removeInventoryItem(item, count)
inventory.addItem(item, count)
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_deposited', count, inventory.getItem(item).label), length = 7500})
end)
-- print("conde_inventory:putItem")
elseif job == 'vault' then
TriggerEvent('otrp_addoninventory:getInventory', 'vault', xPlayerOwner.identifier, function(inventory)
xPlayer.removeInventoryItem(item, count)
inventory.addItem(item, count)
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_deposited', count, inventory.getItem(item).label), length = 7500})
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = "error", text = 'You not have permission for this job!', length = 5500})
end
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = "error", text = _U('invalid_quantity'), length = 5500})
end
elseif type == 'item_account' then
local playerAccountMoney = xPlayer.getAccount(item).money
if playerAccountMoney >= count and count > 0 then
xPlayer.removeAccountMoney(item, count)
if xPlayer.job.name == job and job == 'police' then
TriggerEvent('otrp_addonaccount:getSharedAccount', 'society_'..job..'_'..item, function(account)
account.addMoney(count)
end)
elseif job == 'vault' then
TriggerEvent('otrp_addonaccount:getAccount', 'vault_' .. item, xPlayerOwner.identifier, function(account)
account.addMoney(count)
end)
else
xPlayer.addAccountMoney(item, count)
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = 'This job not allow for black money', length = 5500})
end
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('amount_invalid'), length = 5500})
end
elseif type == 'item_weapon' then
if xPlayer.job.name == job then
TriggerEvent('otrp_datastore:getSharedDataStore', 'society_'..job, function(store)
local storeWeapons = store.get('weapons') or {}
table.insert(storeWeapons, {
name = item,
count = count
})
xPlayer.removeWeapon(item)
store.set('weapons', storeWeapons)
end)
elseif job == 'vault' then
TriggerEvent('otrp_datastore:getDataStore', 'vault', xPlayerOwner.identifier, function(store)
local storeWeapons = store.get('weapons') or {}
table.insert(storeWeapons, {
name = item,
ammo = count
})
xPlayer.removeWeapon(item)
store.set('weapons', storeWeapons)
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = 'You not have permission', length = 5500})
end
end
end)
ESX.RegisterServerCallback('conde_inventory:getVaultInventory', function(source, cb, item, refresh)
-- local xPlayer = ESX.GetPlayerFromIdentifier(owner)
local xPlayer = ESX.GetPlayerFromId(source)
local xItem
if item.needItemLicense ~= '' or item.needItemLicense ~= nil then
xItem = xPlayer.getInventoryItem(item.needItemLicense)
else
xItem = nil
end
local refresh = refresh or false
local blackMoney = 0
local items = {}
local weapons = {}
if not refresh and (item.needItemLicense ~= '' or item.needItemLicense ~= nil) and xItem ~= nil and xItem.count < 1 then
-- if xItem.count < 1 then
cb(false)
-- end
-- return
elseif not item.InfiniteLicense and not refresh and xItem ~= nil and xItem.count > 0 then
-- if not item.InfiniteLicense then
xPlayer.removeInventoryItem(item.needItemLicense, 1)
-- end
end
-- if item.job == xPlayer.job.name then
-- print('u job: '..xPlayer.job.name)
-- end
local typeVault = ''
local society = false
if string.find(item.job, "vault") then
typeVault = item.job
else
typeVault = "society_"..item.job
society = true
end
-- print("Vault: "..typeVault)
if society then
if item.job == 'police' or item.job == 'mecano' then
TriggerEvent('otrp_addonaccount:getSharedAccount', typeVault..'_black_money', function(account)
blackMoney = account.money
end)
else
blackMoney = 0
end
TriggerEvent('otrp_addoninventory:getSharedInventory', typeVault, function(inventory)
items = inventory.items
end)
TriggerEvent('otrp_datastore:getSharedDataStore', typeVault, function(store)
weapons = store.get('weapons') or {}
end)
cb({
blackMoney = blackMoney,
items = items,
weapons = weapons,
job = item.job
})
else
TriggerEvent('otrp_addonaccount:getAccount', typeVault..'_black_money', xPlayer.identifier, function(account)
blackMoney = account.money
end)
TriggerEvent('otrp_addoninventory:getInventory', typeVault, xPlayer.identifier, function(inventory)
items = inventory.items
end)
TriggerEvent('otrp_datastore:getDataStore', typeVault, xPlayer.identifier, function(store)
weapons = store.get('weapons') or {}
end)
cb({
blackMoney = blackMoney,
items = items,
weapons = weapons,
job = item.job
})
end
end)
can’t also can you help?
please help for my problem
- Job whitelists outside the police are not given permission to enter
- a job whitelist outside the police, if checked monster_vault, no red money is detected in the safe even though it was successfully entered
Hi. So i don’t understand what you say 100 %
But i think you say that the Mecano job can’t store black money? Did you make an sql for the Mecano?
INSERT INTO `addon_account` (name, label, shared) VALUES
('vault_black_money', 'Money Vault', 0),
('society_police_black_money', 'Police Black Money', 1)
('society_mecano_black_money', 'Mecano Black Money', 1);
if you have another problem feel free to text me. I can also other languages like germany and hungarian.
SERVER/main.lua
ESX = nil
TriggerEvent('otrp:getSharedObject', function(obj) ESX = obj end)
RegisterServerEvent('conde_inventory:getItem')
AddEventHandler('conde_inventory:getItem', function(--[[owner,--]] job, type, item, count)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local xPlayerOwner = ESX.GetPlayerFromIdentifier(xPlayer.identifier)
if type == 'item_standard' then
local sourceItem = xPlayer.getInventoryItem(item)
if xPlayer.job.name == job then
TriggerEvent('otrp_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)
elseif job == 'vault' then
TriggerEvent('otrp_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
elseif type == 'item_account' then
if xPlayer.job.name == job then
TriggerEvent('otrp_addonaccount:getSharedAccount', 'society_'..job..'_'..item, function(account)
local policeAccountMoney = account.money
if policeAccountMoney >= count then
account.removeMoney(count)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('amount_invalid'), length = 5500})
end
end)
elseif job == 'vault' then
TriggerEvent('otrp_addonaccount:getAccount', 'vault_' .. item, xPlayerOwner.identifier, function(account)
local roomAccountMoney = account.money
if roomAccountMoney >= count then
account.removeMoney(count)
xPlayer.addAccountMoney(item, count)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('amount_invalid'), length = 5500})
end
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = "You not have permission", length = 5500})
end
elseif type == 'item_weapon' then
if xPlayer.job.name == job then
TriggerEvent('otrp_datastore:getSharedDataStore', 'society_'..job, function(store)
local storeWeapons = store.get('weapons') or {}
local weaponName = nil
local ammo = nil
for i=1, #storeWeapons, 1 do
if storeWeapons[i].name == item then
weaponName = storeWeapons[i].name
ammo = storeWeapons[i].ammo
table.remove(storeWeapons, i)
break
end
end
store.set('weapons', storeWeapons)
xPlayer.addWeapon(weaponName, ammo)
end)
elseif job == 'vault' then
TriggerEvent('otrp_datastore:getDataStore', 'vault', xPlayerOwner.identifier, function(store)
local storeWeapons = store.get('weapons') or {}
local weaponName = nil
local ammo = nil
for i=1, #storeWeapons, 1 do
if storeWeapons[i].name == item then
weaponName = storeWeapons[i].name
ammo = storeWeapons[i].ammo
table.remove(storeWeapons, i)
break
end
end
store.set('weapons', storeWeapons)
xPlayer.addWeapon(weaponName, ammo)
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = 'You not have permission', length = 5500})
end
end
end)
RegisterServerEvent('conde_inventory:putItem')
AddEventHandler('conde_inventory:putItem', function(--[[owner,--]] job, type, item, count)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local xPlayerOwner = ESX.GetPlayerFromIdentifier(xPlayer.identifier)
if type == 'item_standard' then
local playerItemCount = xPlayer.getInventoryItem(item).count
if playerItemCount >= count and count > 0 then
if xPlayer.job.name == job then
TriggerEvent('otrp_addoninventory:getSharedInventory', 'society_'..job, function(inventory)
xPlayer.removeInventoryItem(item, count)
inventory.addItem(item, count)
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_deposited', count, inventory.getItem(item).label), length = 7500})
end)
-- print("conde_inventory:putItem")
elseif job == 'vault' then
TriggerEvent('otrp_addoninventory:getInventory', 'vault', xPlayerOwner.identifier, function(inventory)
xPlayer.removeInventoryItem(item, count)
inventory.addItem(item, count)
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_deposited', count, inventory.getItem(item).label), length = 7500})
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = "error", text = 'You not have permission for this job!', length = 5500})
end
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = "error", text = _U('invalid_quantity'), length = 5500})
end
elseif type == 'item_account' then
local playerAccountMoney = xPlayer.getAccount(item).money
if playerAccountMoney >= count and count > 0 then
xPlayer.removeAccountMoney(item, count)
if xPlayer.job.name == job and job == 'police' then
TriggerEvent('otrp_addonaccount:getSharedAccount', 'society_'..job..'_'..item, function(account)
account.addMoney(count)
end)
elseif job == 'vault' then
TriggerEvent('otrp_addonaccount:getAccount', 'vault_' .. item, xPlayerOwner.identifier, function(account)
account.addMoney(count)
end)
else
xPlayer.addAccountMoney(item, count)
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = 'This job not allow for black money', length = 5500})
end
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('amount_invalid'), length = 5500})
end
elseif type == 'item_weapon' then
if xPlayer.job.name == job then
TriggerEvent('otrp_datastore:getSharedDataStore', 'society_'..job, function(store)
local storeWeapons = store.get('weapons') or {}
table.insert(storeWeapons, {
name = item,
count = count
})
xPlayer.removeWeapon(item)
store.set('weapons', storeWeapons)
end)
elseif job == 'vault' then
TriggerEvent('otrp_datastore:getDataStore', 'vault', xPlayerOwner.identifier, function(store)
local storeWeapons = store.get('weapons') or {}
table.insert(storeWeapons, {
name = item,
ammo = count
})
xPlayer.removeWeapon(item)
store.set('weapons', storeWeapons)
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = 'You not have permission', length = 5500})
end
end
end)
ESX.RegisterServerCallback('conde_inventory:getVaultInventory', function(source, cb, item, refresh)
-- local xPlayer = ESX.GetPlayerFromIdentifier(owner)
local xPlayer = ESX.GetPlayerFromId(source)
local xItem
if item.needItemLicense ~= '' or item.needItemLicense ~= nil then
xItem = xPlayer.getInventoryItem(item.needItemLicense)
else
xItem = nil
end
local refresh = refresh or false
local blackMoney = 0
local items = {}
local weapons = {}
if not refresh and (item.needItemLicense ~= '' or item.needItemLicense ~= nil) and xItem ~= nil and xItem.count < 1 then
-- if xItem.count < 1 then
cb(false)
-- end
-- return
elseif not item.InfiniteLicense and not refresh and xItem ~= nil and xItem.count > 0 then
-- if not item.InfiniteLicense then
xPlayer.removeInventoryItem(item.needItemLicense, 1)
-- end
end
-- if item.job == xPlayer.job.name then
-- print('u job: '..xPlayer.job.name)
-- end
local typeVault = ''
local society = false
if string.find(item.job, "vault") then
typeVault = item.job
else
typeVault = "society_"..item.job
society = true
end
-- print("Vault: "..typeVault)
if society then
if item.job == 'police' then
TriggerEvent('otrp_addonaccount:getSharedAccount', typeVault..'_black_money', function(account)
blackMoney = account.money
end)
else
blackMoney = 0
end
TriggerEvent('otrp_addoninventory:getSharedInventory', typeVault, function(inventory)
items = inventory.items
end)
TriggerEvent('otrp_datastore:getSharedDataStore', typeVault, function(store)
weapons = store.get('weapons') or {}
end)
cb({
blackMoney = blackMoney,
items = items,
weapons = weapons,
job = item.job
})
else
TriggerEvent('otrp_addonaccount:getAccount', typeVault..'_black_money', xPlayer.identifier, function(account)
blackMoney = account.money
end)
TriggerEvent('otrp_addoninventory:getInventory', typeVault, xPlayer.identifier, function(inventory)
items = inventory.items
end)
TriggerEvent('otrp_datastore:getDataStore', typeVault, xPlayer.identifier, function(store)
weapons = store.get('weapons') or {}
end)
cb({
blackMoney = blackMoney,
items = items,
weapons = weapons,
job = item.job
})
end
end)
This job not allow for black money
surely after the permit was granted, no amount of red money was detected in the safe
https://youtu.be/CL0U_uLGRkY
After successfully making access allowed
red money is not detected
In Database
** SERVER/main.lua**
ESX = nil
TriggerEvent('otrp:getSharedObject', function(obj) ESX = obj end)
RegisterServerEvent('conde_inventory:getItem')
AddEventHandler('conde_inventory:getItem', function(--[[owner,--]] job, type, item, count)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local xPlayerOwner = ESX.GetPlayerFromIdentifier(xPlayer.identifier)
if type == 'item_standard' then
local sourceItem = xPlayer.getInventoryItem(item)
if xPlayer.job.name == job then
TriggerEvent('otrp_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)
elseif job == 'vault' then
TriggerEvent('otrp_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
elseif type == 'item_account' then
if xPlayer.job.name == job then
TriggerEvent('otrp_addonaccount:getSharedAccount', 'society_'..job..'_'..item, function(account)
local policeAccountMoney = account.money
if policeAccountMoney >= count then
account.removeMoney(count)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('amount_invalid'), length = 5500})
end
end)
elseif job == 'vault' then
TriggerEvent('otrp_addonaccount:getAccount', 'vault_' .. item, xPlayerOwner.identifier, function(account)
local roomAccountMoney = account.money
if roomAccountMoney >= count then
account.removeMoney(count)
xPlayer.addAccountMoney(item, count)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('amount_invalid'), length = 5500})
end
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = "You not have permission", length = 5500})
end
elseif type == 'item_weapon' then
if xPlayer.job.name == job then
TriggerEvent('otrp_datastore:getSharedDataStore', 'society_'..job, function(store)
local storeWeapons = store.get('weapons') or {}
local weaponName = nil
local ammo = nil
for i=1, #storeWeapons, 1 do
if storeWeapons[i].name == item then
weaponName = storeWeapons[i].name
ammo = storeWeapons[i].ammo
table.remove(storeWeapons, i)
break
end
end
store.set('weapons', storeWeapons)
xPlayer.addWeapon(weaponName, ammo)
end)
elseif job == 'vault' then
TriggerEvent('otrp_datastore:getDataStore', 'vault', xPlayerOwner.identifier, function(store)
local storeWeapons = store.get('weapons') or {}
local weaponName = nil
local ammo = nil
for i=1, #storeWeapons, 1 do
if storeWeapons[i].name == item then
weaponName = storeWeapons[i].name
ammo = storeWeapons[i].ammo
table.remove(storeWeapons, i)
break
end
end
store.set('weapons', storeWeapons)
xPlayer.addWeapon(weaponName, ammo)
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = 'You not have permission', length = 5500})
end
end
end)
RegisterServerEvent('conde_inventory:putItem')
AddEventHandler('conde_inventory:putItem', function(--[[owner,--]] job, type, item, count)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local xPlayerOwner = ESX.GetPlayerFromIdentifier(xPlayer.identifier)
if type == 'item_standard' then
local playerItemCount = xPlayer.getInventoryItem(item).count
if playerItemCount >= count and count > 0 then
if xPlayer.job.name == job then
TriggerEvent('otrp_addoninventory:getSharedInventory', 'society_'..job, function(inventory)
xPlayer.removeInventoryItem(item, count)
inventory.addItem(item, count)
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_deposited', count, inventory.getItem(item).label), length = 7500})
end)
-- print("conde_inventory:putItem")
elseif job == 'vault' then
TriggerEvent('otrp_addoninventory:getInventory', 'vault', xPlayerOwner.identifier, function(inventory)
xPlayer.removeInventoryItem(item, count)
inventory.addItem(item, count)
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'success', text = _U('have_deposited', count, inventory.getItem(item).label), length = 7500})
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = "error", text = 'You not have permission for this job!', length = 5500})
end
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = "error", text = _U('invalid_quantity'), length = 5500})
end
elseif type == 'item_account' then
local playerAccountMoney = xPlayer.getAccount(item).money
if playerAccountMoney >= count and count > 0 then
xPlayer.removeAccountMoney(item, count)
if xPlayer.job.name == job and job == 'police' then
TriggerEvent('otrp_addonaccount:getSharedAccount', 'society_'..job..'_'..item, function(account)
account.addMoney(count)
end)
elseif xPlayer.job.name == job and job == 'mecano' then
TriggerEvent('otrp_addonaccount:getSharedAccount', 'society_'..job..'_'..item, function(account)
account.addMoney(count)
end)
elseif job == 'vault' then
TriggerEvent('otrp_addonaccount:getAccount', 'vault_' .. item, xPlayerOwner.identifier, function(account)
account.addMoney(count)
end)
else
xPlayer.addAccountMoney(item, count)
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = 'This job not allow for black money', length = 5500})
end
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = _U('amount_invalid'), length = 5500})
end
elseif type == 'item_weapon' then
if xPlayer.job.name == job then
TriggerEvent('otrp_datastore:getSharedDataStore', 'society_'..job, function(store)
local storeWeapons = store.get('weapons') or {}
table.insert(storeWeapons, {
name = item,
count = count
})
xPlayer.removeWeapon(item)
store.set('weapons', storeWeapons)
end)
elseif job == 'vault' then
TriggerEvent('otrp_datastore:getDataStore', 'vault', xPlayerOwner.identifier, function(store)
local storeWeapons = store.get('weapons') or {}
table.insert(storeWeapons, {
name = item,
ammo = count
})
xPlayer.removeWeapon(item)
store.set('weapons', storeWeapons)
end)
else
TriggerClientEvent('mythic_notify:client:SendAlert', _source, {type = 'error', text = 'You not have permission', length = 5500})
end
end
end)
ESX.RegisterServerCallback('conde_inventory:getVaultInventory', function(source, cb, item, refresh)
-- local xPlayer = ESX.GetPlayerFromIdentifier(owner)
local xPlayer = ESX.GetPlayerFromId(source)
local xItem
if item.needItemLicense ~= '' or item.needItemLicense ~= nil then
xItem = xPlayer.getInventoryItem(item.needItemLicense)
else
xItem = nil
end
local refresh = refresh or false
local blackMoney = 0
local items = {}
local weapons = {}
if not refresh and (item.needItemLicense ~= '' or item.needItemLicense ~= nil) and xItem ~= nil and xItem.count < 1 then
-- if xItem.count < 1 then
cb(false)
-- end
-- return
elseif not item.InfiniteLicense and not refresh and xItem ~= nil and xItem.count > 0 then
-- if not item.InfiniteLicense then
xPlayer.removeInventoryItem(item.needItemLicense, 1)
-- end
end
-- if item.job == xPlayer.job.name then
-- print('u job: '..xPlayer.job.name)
-- end
local typeVault = ''
local society = false
if string.find(item.job, "vault") then
typeVault = item.job
else
typeVault = "society_"..item.job
society = true
end
-- print("Vault: "..typeVault)
if society then
if item.job == 'police' then
TriggerEvent('otrp_addonaccount:getSharedAccount', typeVault..'_black_money', function(account)
blackMoney = account.money
end)
elseif item.job == 'mecano' then
TriggerEvent('otrp_addonaccount:getSharedAccount', typeVault..'_black_money', function(account)
blackMoney = account.money
end)
else
blackMoney = 0
end
TriggerEvent('otrp_addoninventory:getSharedInventory', typeVault, function(inventory)
items = inventory.items
end)
TriggerEvent('otrp_datastore:getSharedDataStore', typeVault, function(store)
weapons = store.get('weapons') or {}
end)
cb({
blackMoney = blackMoney,
items = items,
weapons = weapons,
job = item.job
})
else
TriggerEvent('otrp_addonaccount:getAccount', typeVault..'_black_money', xPlayer.identifier, function(account)
blackMoney = account.money
end)
TriggerEvent('otrp_addoninventory:getInventory', typeVault, xPlayer.identifier, function(inventory)
items = inventory.items
end)
TriggerEvent('otrp_datastore:getDataStore', typeVault, xPlayer.identifier, function(store)
weapons = store.get('weapons') or {}
end)
cb({
blackMoney = blackMoney,
items = items,
weapons = weapons,
job = item.job
})
end
end)
VIDEO :
Screenshoot F8
In Server/main.lua you did it wrong
if society then
if item.job == 'police' then
TriggerEvent('otrp_addonaccount:getSharedAccount', typeVault..'_black_money', function(account)
blackMoney = account.money
end)
elseif item.job == 'mecano' then
TriggerEvent('otrp_addonaccount:getSharedAccount', typeVault..'_black_money', function(account)
blackMoney = account.money
end)
This is absolutly wrong. You should do this:
if society then
if item.job == 'police' or item.job == 'mecano' then
TriggerEvent('otrp_addonaccount:getSharedAccount', typeVault..'_black_money', function(account)
blackMoney = account.money
end)
thank you. Working.