Functions

if GetResourceState("qb-core") == "started" then
    QBCore = exports['qb-core']:GetCoreObject()
elseif GetResourceState("es_extended") == "started" then
    ESX = exports.es_extended:getSharedObject()
end

function Notify(msg, type, time)
    if GetResourceState("qb-core") == "started" then
        QBCore.Functions.Notify(msg, type, time)
    elseif GetResourceState("okokNotify") == "started" then
        exports['okokNotify']:Alert('Crafting', msg, 5000, type, true)
    elseif GetResourceState("ox_lib") == "started" then
        lib.notify({ title = 'Crafting', description = msg, type = type })
    end
end

function SendHelpText(msg, position)
    if GetResourceState("qb-core") == "started" then
        exports['qb-core']:DrawText(msg, position)
    elseif GetResourceState("ox_lib") == "started" then
        lib.showTextUI(msg)
    end
end

function RemoveHelpText()
    if GetResourceState("qb-core") == "started" then
        exports['qb-core']:HideText()
    elseif GetResourceState("ox_lib") == "started" then
        lib.hideTextUI()
    end
end

function Minigame(callback)
    if GetResourceState("ps-ui") == "started" then
        exports['ps-ui']:Circle(function(success)
            if success then
                callback(success)
            else
                Notify("You failed the minigame!", "error", 5000)
            end
        end, 2, 20)
    elseif GetResourceState("bl_ui") == "started" then
        local success = exports.bl_ui:CircleProgress(1, 20)
        if success then
            callback(success)
        else
            Notify("You failed the minigame!", "error", 5000)
        end
    elseif GetResourceState("ox_lib") == "started" then
        local success = lib.skillCheck({'easy', 'easy', {areaSize = 60, speedMultiplier = 2}, 'hard'}, {'w', 'a', 's', 'd'})
        if success then
            callback(success)
        else
            Notify("You failed the minigame!", "error", 5000)
        end
    end
end

function StartAnimation(animation)
    if GetResourceState("dpemotes") == "started" then
        TriggerEvent('animations:client:EmoteCommandStart', {animation})
    elseif GetResourceState("rpemotes") == "started" then
        exports["rpemotes"]:EmoteCommandStart(animation)
    elseif GetResourceState("scully_emotemenu") == "started" then
        exports["scully_emotemenu"]:playEmoteByCommand(animation)
    end
end

function CancelAnimation()
    if GetResourceState("dpemotes") == "started" then
        TriggerEvent('animations:client:EmoteCommandStart', {"c"})
    elseif GetResourceState("rpemotes") == "started" then
        exports["rpemotes"]:EmoteCommandStart("c")
    elseif GetResourceState("scully_emotemenu") == "started" then
        exports["scully_emotemenu"]:cancelEmote()
    end
end

Last updated