Reputation

CLIENT & SERVER SIDE

A standalone reputation system that provides a flexible approach to managing reputations for various entities like jobs, NPC groups, or factions. It operates independently of any external framework, making it suitable for a wide range of applications.

Client Functions

get_reputations

Retrieve a list of all reputations the player has.

Function

local function get_reputations()
    utils.callback.cb('boii_utils:sv:get_reputations', {}, function(reputation_data)
        if reputation_data then
            debug_log('info', 'Reputation data fetched: '.. json.encode(reputation_data))
            return reputation_data
        else
            debug_log('err', 'Failed to fetch reputation data.')
            return nil
        end
    end)
end

exports('get_reputations', get_reputations)
utils.reputation.get_reputations = get_reputations

Example

--- Utils object
local reputations = utils.reputation.get_reputations()

--- Direct export
local reputations = exports.boii_utils:get_reputations()

get_reputation

Retrieve a specific reputation the player has.

Function

local function get_reputation(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_reputation', get_reputation)
utils.reputation.get_reputation = get_reputation

Example

--- Define reputation
local reputation = 'ballas'

--- Utils object
utils.reputation.get_reputation(reputation)

--- Direct export
exports.boii_utils:get_reputation(reputation)

Server Functions

Last updated