Integration

ESX Notify Integration

es_extended/client/functions.lua

function ESX.ShowNotification(message, notifyType, length)
    notifyType = notifyType or 'success'
    length = tonumber(length) or 5

    if IsResourceFound('esx_notify') then
        exports['esx_notify']:Notify(notifyType, length, message)
    elseif GetResourceState('frkn-uikit') == 'started' then
        exports['frkn-uikit']:Notify(notifyType, length, message)
    end
end

Esx Progressbar Integration

es_extended/client/functions.lua

function ESX.Progressbar(message, length, options)
    length = tonumber(length) or 5000
    options = options or {}

    if IsResourceFound('esx_progressbar') then
        return exports['esx_progressbar']:Progressbar(message, length, options)
    elseif GetResourceState('frkn-uikit') == 'started' then
        local progressModel = options.progressModel or "progressbar-1"
        local label = message or "Processing..."
        local duration = length or 5000
        local useWhileDead = options.useWhileDead or false
        local canCancel = options.canCancel ~= false
        local disableControls = options.disableControls or {
            disableMovement = false,
            disableCarMovement = false,
            disableMouse = false,
            disableCombat = true,
        }

        local anim = options.anim or {}
        local prop = options.prop or {}
        local propTwo = options.propTwo or {}
        local onFinish = options.onFinish
        local onCancel = options.onCancel

        exports['frkn-uikit']:Progressbar(progressModel, label, duration, useWhileDead, canCancel, disableControls, anim, prop, propTwo, onFinish, onCancel)
    else
        print(('[FRKN-UIKIT] Progressbar fallback: %s (%sms)'):format(message, length))
    end
end

Qb Qbox Notify Integration

qb-core/server/player.lua

function self.Functions.Notify(text, type, length)
    type = type or 'success'
    length = tonumber(length) or 5

    local src = self.PlayerData.source

    if GetResourceState('frkn-uikit') == 'started' then
        TriggerClientEvent('frkn-uikit:Notify', src, type, length, text)
    else
        TriggerClientEvent('QBCore:Notify', src, text, type, length)
    end
end

qb-core/client/functions.lua

function QBCore.Functions.Notify(text, texttype, length, icon)
    local notifyType = texttype or 'success'
    local duration = tonumber(length) or 5
    local message = ''

    if type(text) == 'table' then
        message = text.text or 'Notification'
    else
        message = text or 'Notification'
    end

    if GetResourceState('frkn-uikit') == 'started' then
        exports['frkn-uikit']:Notify(notifyType, duration, message)
    else
        local msg = {
            action = 'notify',
            type = texttype or 'primary',
            length = length or 5000,
        }

        if type(text) == 'table' then
            msg.text = text.text or 'Placeholder'
            msg.caption = text.caption or 'Placeholder'
        else
            msg.text = text
        end

        if icon then
            msg.icon = icon
        end

        SendNUIMessage(msg)
    end
end

Qb Qbox Progressbar Integration

qb-core/client/functions.lua

function QBCore.Functions.Progressbar(name, label, duration, useWhileDead, canCancel, disableControls, animation, prop, propTwo, onFinish, onCancel)
    if GetResourceState('frkn-uikit') ~= 'started' then
        error('frkn-uikit needs to be started in order for QBCore.Functions.Progressbar to work')
    end

    exports['frkn-uikit']:Progressbar(
        name or 'progressbar-1',
        label or 'Processing...',
        duration or 5000,
        useWhileDead or false,
        canCancel ~= false, 
        disableControls or {
            disableMovement = false,
            disableCarMovement = false,
            disableMouse = false,
            disableCombat = true
        },
        animation or {},
        prop or {},
        propTwo or {},
        function()
            if onFinish then
                onFinish()
            end
        end,
        function()
            if onCancel then
                onCancel()
            end
        end
    )
end

Last updated