AddEventHandler('esx:playerLoaded', function(data)
local xPlayer = ESX.GetPlayerFromId(data)
loadInventory(xPlayer.identifier, 'player', function()
end)
Citizen.Wait(1000)
local dbInventory = MySQL.Sync.fetchAll('SELECT * FROM disc_inventory WHERE type = @type AND owner = @owner', {
['@type'] = 'player',
['@owner'] = xPlayer.identifier
})
if dbInventory[1] ~= nil then
for k,v in pairs(xPlayer.getInventory()) do
if v['count'] > 0 then
for key, value in pairs(json.decode(dbInventory[1].data)) do
if v['name'] == value['name'] then
print('v : ' .. v['name'] .. '-' .. v['count'] .. ' -- value: ' .. value['name'] .. ' - ' .. value['count'])
if v['count'] ~= value['count'] then
TriggerEvent('disc-inventoryhud:rconLogEnsureInv', xPlayer.source)
TriggerClientEvent('mythic_notify:client:SendAlert', xPlayer.source, { type = 'inform', text = 'Envanter oluşturuluyor...' })
break
end
end
end
end
end
end
end)