local QBCore = exports['qb-core']:GetCoreObject() QBCore.Functions.CreateUseableItem("customlicense", function(source, item) local src = source local Player = QBCore.Functions.GetPlayer(src) local ItemData = Player.PlayerData.items[item.slot] if ItemData.info.bname ~= nil then for k, v in pairs(QBCore.Functions.GetPlayers()) do local PlayerPed = GetPlayerPed(source) local TargetPed = GetPlayerPed(v) local dist = #(GetEntityCoords(PlayerPed) - GetEntityCoords(TargetPed)) if dist < 3.0 then TriggerClientEvent('chat:addMessage', v, { template = '', args = {'Business License', item.info.bname, item.info.bowner, item.info.btype, item.info.idate, item.info.edate, item.info.iname} }) end end if ItemData.description == 'Custom License' then Player.PlayerData.items[item.slot].description = "

Business Name: " .. ItemData.info.bname .. "

Business Owner: " .. ItemData.info.bowner .. "

Business Type: " .. ItemData.info.btype .. "

Reg. Address: " .. ItemData.info.baddress .. "

Issue Date: " .. ItemData.info.idate .. "

Expiry Date: " .. ItemData.info.edate .. "

Issuing Authority: " .. ItemData.info.iname .. "

" Player.Functions.SetInventory(Player.PlayerData.items, true) end else TriggerClientEvent('QBCore:Notify', src, 'This License is not valid.') end end) RegisterServerEvent('cr-licensing:server:NewLicense') AddEventHandler('cr-licensing:server:NewLicense', function(data) local src = source local Player = QBCore.Functions.GetPlayer(src) local citizenid = Player.PlayerData.citizenid if data ~= nil then Player.Functions.AddItem('customlicense', 1, false, data) TriggerClientEvent('QBCore:Notify', src, 'You issued a new License! It is added to your Inventory.', 'success', 8000) TriggerClientEvent("inventory:client:ItemBox", src, QBCore.Shared.Items["customlicense"], "add") end end)