Skills

CLIENT & SERVER SIDE

A standalone skill system that provides a flexible approach to managing skills independently of any external framework. System is persistent, easy to use and relatively in-depth.

For QBCore any metadata with id's matching any of the skill ids will be converted to utils skills data when a player joins the server to ensure players do not lose any existing metadata.

Client Functions

get_skills

Retrieve a list of all reputations the player has.

Function

local function get_skills()
    utils.callback.cb('boii_utils:sv:get_skills', {}, function(skills_data)
        if skills_datathen
            print('Skills data fetched: '.. json.encode(skills_data))
            return skills_data
        else
            print('Failed to fetch reputation data.')
            return nil
        end
    end)
end

exports('get_skills', get_skills)
utils.skills.get_skills = get_skills

Example

--- Utils object
local skills = utils.skills.get_skills()

--- Direct export
local skills = exports.boii_utils:get_skills()

get_skill

Retrieve a specific reputation the player has.

Function

local function get_skill(reputation_name)
    utils.callback.cb('boii_utils:sv:get_reputations', {}, function(reputation_data)
        if reputation_data and reputation_data[reputation_name] then
            debug_log('info', 'Data for reputation ' .. reputation_name .. ': ' .. json.encode(reputation_data[reputation_name]))
            return reputation_data[reputation_name]
        else
            debug_log('err', 'Failed to fetch data for reputation ' .. reputation_name .. '.')
            return nil
        end
    end)
end

exports('get_skill', get_skill)
utils.skills.get_skill = get_skill

Example

--- Define reputation
local skill = 'lockpicking'

--- Utils object
utils.skills.get_skill(skill)

--- Direct export
exports.boii_utils:get_skill(skill)

Server Functions

Last updated