if Config.framework == "qb" then
    local QBCore = exports['qb-core']:GetCoreObject()

    RegisterNetEvent('QBCore:Client:OnJobUpdate')
    AddEventHandler('QBCore:Client:OnJobUpdate', function(job)
        local playerData = QBCore.Functions.GetPlayerData()
        playerData.job = job
        if Config.usetarget == true then
            createtargetjob() -- don't delete
        end
    end)

    function getPlayerJob()
        local playerData = QBCore.Functions.GetPlayerData()
        return playerData.job.name
    end
    
    function notificationfunction(message, typeNotif)
        if Config.notif == "ESX" then
            ESX.ShowNotification(message)
        elseif Config.notif == "OX" then
            lib.notify({
                description = message,
                position = 'top',
                type = typeNotif,
            })
        elseif Config.notif == "custom" then
            Config.customnotif(message, typeNotif)
        end
    end

    function helpnotificationfunction(message, position)
        if Config.interact == "esx" then
            ESX.ShowHelpNotification(message)
        elseif Config.interact == "floating" then
            AddTextEntry('HelpText', message)
            SetFloatingHelpTextWorldPosition(1, position)
            SetFloatingHelpTextStyle(1, 1, 2, -1, 3, 0)
            BeginTextCommandDisplayHelp('HelpText')
            EndTextCommandDisplayHelp(2, false, false, -1)
        elseif Config.interact == "draw3dtext" then
            DrawText3D(position.x, position.y, position.z, message)
        end
    end

    function DrawText3D(x, y, z, text)
        SetTextScale(0.35, 0.35)
        SetTextFont(4)
        SetTextProportional(1)
        SetTextColour(255, 255, 255, 215)
        SetTextEntry('STRING')
        SetTextCentre(true)
        AddTextComponentString(text)
        SetDrawOrigin(x, y, z, 0)
        DrawText(0.0, 0.0)
        local factor = string.len(text) / 370
        DrawRect(0.0, 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
        ClearDrawOrigin()
    end

    RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
        initialiseScripts()
    end)
end