Usage & Integration

You can easily integrate the Qubit Honor system into any desired job using the client-side and server-side exports. You can find the exports below.

Client Side Usage
exports['qubit-honorsystem']:IncreaseHonor(amount, reason)
exports['qubit-honorsystem']:DecreaseHonor(amount, reason)
exports['qubit-honorsystem']:GetHonor()
exports['qubit-honorsystem']:GetHonorPercentage()
exports['qubit-honorsystem']:GetHonorLevel()
Server Side Usage
exports['qubit-honorsystem']:IncreaseHonor(source, amount, reason)
exports['qubit-honorsystem']:DecreaseHonor(source, amount, reason)
exports['qubit-honorsystem']:GetHonor(source)
exports['qubit-honorsystem']:GetHonorPercentage(source)
exports['qubit-honorsystem']:GetHonorLevel(source)

Decrease/Increase Honor Export

The "Increase Honor" export is used in both server and client Lua files to increase a user's honor value. Here are a few real usage examples:

Example Script snippet qbx_truckrobbery/client/main.lua

local function lootTruck()
    local looting = true
	CreateThread(function()
        if lib.progressBar({
            duration = config.lootDuration,
            label = locale('info.looting_truck'),
            useWhileDead = false,
            canCancel = true,
            disable = {
                move = true,
                car = true,
                combat = true,
                mouse = false,
            },
            anim = {
                dict = 'anim@heists@ornate_bank@grab_cash_heels',
                clip = 'grab',
                flag = 1,
            },
            prop = {
                model = `prop_cs_heist_bag_02`,
                bone = 57005,
                pos = vec3(0.0, 0.0, -0.16),
                rot = vec3(250.0, -30.0, 0.0),
            }
        }) then
            local success = lib.callback.await('qbx_truckrobbery:server:giveReward')
            -- WE ARE DECREASE HONOR FOR TRUCK ROBBERY ON CLIENT SIDE
            exports['qubit-honorsystem']:DecreaseHonor(500, "BANK TRUCK ROBBED")
            -- exports['qubit-honorsystem']:IncreaseHonor(500, "BANK TRUCK ROBBED")
            if not success then return end
            SetPedComponentVariation(cache.ped, 5, 45, 0, 2)
            resetMission()
        end
        looting = false
    end)
    while looting do
        if #(GetEntityCoords(cache.ped) - GetEntityCoords(truck)) > 6 and lib.progressActive() then
            lib.cancelProgress()
        end
        Wait(1000)
    end
end

Let's do the same example for the server side:

Example Script snippet qbx_truckrobbery/server/main.lua

GetHonorLevel Honor Export

In this way, we can grant or reduce honor for the user within any profession. Now, for example, we want to adjust the user's earnings based on their honor level. To do this, we will use the GetHonorLevel export and, depending on the level, define what they will receive using the desired variable.

Example Script snippet qbx_truckrobbery/server/main.lua

In the example above, I used the GetHonorLevel export to retrieve the user's current level data. This level data includes the following values, which come from config.lua

GetHonorLevel Export Response;

Here, I created a custom variable inside the levelData variable in config.lua by using the script's name, and I named it rewardMultiplier. You can define anything you wantโ€”this value doesn't have to be a number; it can also be an array or a string, depending on what you want to store for a specific job. Then, I set this value to 1.4 in config.lua so that players with the SlightlyBad level will receive 1.4 times more items from this heist. The current config.lua looks like the following:

Last updated

Was this helpful?