{0}:
Borger ID: {1}
Fornavn: {2}
Efternavn: {3}
Fødselsdato: {4}
Køn: {5}
Nationalitet: {6}
',
+ args = {
+ "ID Kort",
+ item.info.citizenid,
+ item.info.firstname,
+ item.info.lastname,
+ item.info.birthdate,
+ gender,
+ item.info.nationality
+ }
+ }
+ )
+ end
+ end
+end)
+
+
+CreateThread(function()
+ while true do
+ for k, v in pairs(Drops) do
+ if v and (v.createdTime + Config.CleanupDropTime < os.time()) and not Drops[k].isOpen then
+ Drops[k] = nil
+ TriggerClientEvent("inventory:client:RemoveDropItem", -1, k)
+ end
+ end
+ Wait(60 * 1000)
+ end
+end)
+
+-- Decay System
+
+local TimeAllowed = 60 * 60 * 24 * 1 -- Maths for 1 day dont touch its very important and could break everything
+function ConvertQuality(item)
+ local StartDate = item.created
+ local DecayRate = QBCore.Shared.Items[item.name:lower()]["decay"] ~= nil and QBCore.Shared.Items[item.name:lower()]["decay"] or 0.0
+ if DecayRate == nil then
+ DecayRate = 0
+ end
+ local TimeExtra = math.ceil((TimeAllowed * DecayRate))
+ local percentDone = 100 - math.ceil((((os.time() - StartDate) / TimeExtra) * 100))
+ if DecayRate == 0 then
+ percentDone = 100
+ end
+ if percentDone < 0 then
+ percentDone = 0
+ end
+ return percentDone
+end
+
+QBCore.Functions.CreateCallback('inventory:server:ConvertQuality', function(source, cb, inventory, other)
+ local src = source
+ local data = {}
+ local Player = QBCore.Functions.GetPlayer(src)
+ for _, item in pairs(inventory) do
+ if item.created then
+ if QBCore.Shared.Items[item.name:lower()]["decay"] ~= nil or QBCore.Shared.Items[item.name:lower()]["decay"] ~= 0 then
+ if item.info then
+ if type(item.info) == "string" then
+ item.info = {}
+ end
+ if item.info.quality == nil then
+ item.info.quality = 100
+ end
+ else
+ local info = {quality = 100}
+ item.info = info
+ end
+ local quality = ConvertQuality(item)
+ if item.info.quality then
+ if quality < item.info.quality then
+ item.info.quality = quality
+ end
+ else
+ item.info = {quality = quality}
+ end
+ else
+ if item.info then
+ item.info.quality = 100
+ else
+ local info = {quality = 100}
+ item.info = info
+ end
+ end
+ end
+ end
+ if other then
+ local inventoryType = QBCore.Shared.SplitStr(other.name, "-")[1]
+ local uniqueId = QBCore.Shared.SplitStr(other.name, "-")[2]
+ if inventoryType == "trunk" then
+ for _, item in pairs(other.inventory) do
+ if item.created then
+ if QBCore.Shared.Items[item.name:lower()]["decay"] ~= nil or QBCore.Shared.Items[item.name:lower()]["decay"] ~= 0 then
+ if item.info then
+ if item.info.quality == nil then
+ item.info.quality = 100
+ end
+ else
+ local info = {quality = 100}
+ item.info = info
+ end
+ local quality = ConvertQuality(item)
+ if item.info.quality then
+ if quality < item.info.quality then
+ item.info.quality = quality
+ end
+ else
+ item.info = {quality = quality}
+ end
+ else
+ if item.info then
+ item.info.quality = 100
+ else
+ local info = {quality = 100}
+ item.info = info
+ end
+ end
+ end
+ end
+ Trunks[uniqueId].items = other.inventory
+ TriggerClientEvent("inventory:client:UpdateOtherInventory", Player.PlayerData.source, other.inventory, false)
+ elseif inventoryType == "glovebox" then
+ for _, item in pairs(other.inventory) do
+ if item.created then
+ if QBCore.Shared.Items[item.name:lower()]["decay"] ~= nil or QBCore.Shared.Items[item.name:lower()]["decay"] ~= 0 then
+ if item.info then
+ if item.info.quality == nil then
+ item.info.quality = 100
+ end
+ else
+ local info = {quality = 100}
+ item.info = info
+ end
+ local quality = ConvertQuality(item)
+ if item.info.quality then
+ if quality < item.info.quality then
+ item.info.quality = quality
+ end
+ else
+ item.info = {quality = quality}
+ end
+ else
+ if item.info then
+ item.info.quality = 100
+ else
+ local info = {quality = 100}
+ item.info = info
+ end
+ end
+ end
+ end
+ Gloveboxes[uniqueId].items = other.inventory
+ TriggerClientEvent("inventory:client:UpdateOtherInventory", Player.PlayerData.source, other.inventory, false)
+ elseif inventoryType == "stash" then
+ for _, item in pairs(other.inventory) do
+ if item.created then
+ if QBCore.Shared.Items[item.name:lower()]["decay"] ~= nil or QBCore.Shared.Items[item.name:lower()]["decay"] ~= 0 then
+ if item.info then
+ if type(item.info) == "string" then
+ item.info = {}
+ end
+ if item.info.quality == nil then
+ item.info.quality = 100
+ end
+ else
+ local info = {quality = 100}
+ item.info = info
+ end
+ local quality = ConvertQuality(item)
+ if item.info.quality then
+ if quality < item.info.quality then
+ item.info.quality = quality
+ end
+ else
+ item.info = {quality = quality}
+ end
+ else
+ if item.info then
+ item.info.quality = 100
+ else
+ local info = {quality = 100}
+ item.info = info
+ end
+ end
+ end
+ end
+ Stashes[uniqueId].items = other.inventory
+ TriggerClientEvent("inventory:client:UpdateOtherInventory", Player.PlayerData.source, other.inventory, false)
+ end
+ end
+ Player.Functions.SetInventory(inventory)
+ TriggerClientEvent("inventory:client:UpdatePlayerInventory", Player.PlayerData.source, false)
+ data.inventory = inventory
+ data.other = other
+ cb(data)
+end)
+
+-- Warning Messages
+
+RegisterNetEvent('inventory:server:addTrunkItems', function()
+ print('inventory:server:addTrunkItems has been deprecated please use exports[\'ps-inventory\']:addTrunkItems(plate, items)')
+end)
+RegisterNetEvent('inventory:server:addGloveboxItems', function()
+ print('inventory:server:addGloveboxItems has been deprecated please use exports[\'ps-inventory\']:addGloveboxItems(plate, items)')
+end)