Installation

Extract and drop script in your resource folder.

Open config.lua and set your best settings.

Check fisrt the framework section and set to your framework functions:

Config.Framework = {}

Config.Framework.Name = "QBCORE" -- QBCORE or ESX

Config.Framework.GetCore = function()
    if Config.Framework.Name == "QBCORE" then
        return exports["qb-core"]:GetCoreObject()
    end
    if Config.Framework.Name == "ESX" then
        return exports["es_extended"]:getSharedObject()
    end
    return nil
end

Config.Framework.Core = Config.Framework.GetCore()

Config.Framework.Notify = function(msg)
    if Config.Framework.Name == "QBCORE" then
        local _core = Config.Framework.Core
        if _core then
            _core.Functions.Notify(msg)
        end
    elseif Config.Framework.Name == "ESX" then
        local _core = Config.Framework.Core
        if _core then
            _core.ShowNotification(msg)
        end
    end
end

Config.Framework.GetJob = function()
    if Config.Framework.Name == "QBCORE" then
        local _core = Config.Framework.Core
        if _core then
            local _playerdata = _core.Functions.GetPlayerData()
            if _playerdata and _playerdata.job then
                return _playerdata.job.name
            end
        end
    elseif Config.Framework.Name == "ESX" then
        local _core = Config.Framework.Core
        if _core then
            local _playerdata = _core.GetPlayerData()
            if _playerdata and _playerdata.job then
                return _playerdata.job.name
            end
        end
    end
    return ""
end

Config.Framework.GetDuty = function()
    if Config.Framework.Name == "QBCORE" then
        local _core = Config.Framework.Core
        if _core then
            local _playerdata = _core.Functions.GetPlayerData()
            if _playerdata and _playerdata.job then
                return _playerdata.job.onduty
            end
        end
    elseif Config.Framework.Name == "ESX" then
        return true
    end
    return false
end

Config.Framework.GetPlayer = function(src)
    src = tonumber(src)
    if Config.Framework.Name == "QBCORE" then
        local _core = Config.Framework.Core
        if _core then
            local _playerdata = _core.Functions.GetPlayer(src)
            if _playerdata then
                return _playerdata
            end
        end
    elseif Config.Framework.Name == "ESX" then
        local _core = Config.Framework.GetCore()
        if _core then
            local _playerdata = _core.GetPlayerFromId(src)
            if _playerdata then
                return _playerdata
            end
        end
    end
    return nil
end

You can add custom action buttons or delete from the config file:

Now Select your language in language.lua:

Start the script! now need config your other resources to my dispatch calls. ¡ Follow the api functions next !

Last updated