# Frameworks

### server/custom/framework

{% tabs %}
{% tab title="QB-CORE" %}

```lua
Config.Framework = 'qb-core' -- auto/qb-core/qbox/esx/vrp/standalone
```

```lua
if Config.Framework ~= 'qb-core' then
    return
end

Framework = {}

local QBCore = exports['qb-core']:GetCoreObject()

function Framework.GetPlayerIdentifier(source)
   return QBCore.Functions.GetPlayer(source)?.PlayerData?.citizenid
end

function Framework.GetSourceFromIdentifier(identifier)
    return QBCore.Functions.GetPlayerByCitizenId(identifier)?.PlayerData?.source
end

function Framework.AddMoney(identifier, amount, reason)
    local source = Framework.GetSourceFromIdentifier(identifier)
    local PlayerData = QBCore.Functions.GetPlayer(source)
    PlayerData.Functions.AddMoney('bank', amount, reason)
end

function Framework.RegisterCommand(name, description, callback, group)
    QBCore.Commands.Add(name, description, {}, false, callback, group)
end
```

{% endtab %}

{% tab title="QBOX" %}

```lua
Config.Framework = 'qbox' -- auto/qb-core/qbox/esx/vrp/standalone
```

```lua
if Config.Framework ~= 'qbox' then
    return
end

Framework = {}

function Framework.GetPlayerIdentifier(source)
    return exports['qbx_core']:GetPlayer(source)?.PlayerData?.citizenid
end

function Framework.GetSourceFromIdentifier(identifier)
    return exports['qbx_core']:GetPlayerByCitizenId(identifier)?.PlayerData?.source
end

function Framework.AddMoney(identifier, amount, reason)
    local source = Framework.GetSourceFromIdentifier(identifier)
    local player = exports['qbx_core']:GetPlayer(source)
    return player.Functions.AddMoney('bank', amount, reason)
end

function Framework.RegisterCommand(name, description, callback, group)
    lib.addCommand(name, {
        help = description,
        restricted = group and ('group.%s'):format(group) or nil
    }, callback)
end
```

{% endtab %}

{% tab title="ESX" %}

```lua
Config.Framework = 'esx' -- auto/qb-core/qbox/esx/vrp/standalone
```

```lua
if Config.Framework ~= 'esx' then
    return
end

Framework = {}

local success, ESX = pcall(function()
    return exports['es_extended']:getSharedObject()
end)

if not success then
    TriggerEvent('esx:getSharedObject', function(object)
        ESX = object
    end)
end

function Framework.GetPlayerIdentifier(source)
   return ESX.GetPlayerFromId(source)?.identifier
end

function Framework.GetSourceFromIdentifier(identifier)
   return ESX.GetPlayerFromIdentifier(identifier)?.source
end

function Framework.AddMoney(identifier, amount, reason)
    local source = Framework.GetSourceFromIdentifier(identifier)
    local player = ESX.GetPlayerFromId(source)
    return player.addMoney(amount)
end

function Framework.RegisterCommand(name, description, callback, group)
    ESX.RegisterCommand(name, group, function(player)
        return callback(player.source)
    end, true, {
        help = description,
        arguments = {}
    })
end
```

{% endtab %}

{% tab title="VRP" %}

```lua
Config.Framework = 'vrp' -- auto/qb-core/qbox/esx/vrp/standalone
```

```lua
if Config.Framework ~= 'vrp' then
    return
end

local Proxy = module('vrp', 'lib/Proxy')
local vRP = Proxy.getInterface('vRP')

Framework = {}

function Framework.GetPlayerIdentifier(source)
    local id = vRP.getUserId { source }
    return tostring(id)
end

function Framework.GetSourceFromIdentifier(identifier)
    identifier = tonumber(identifier)
    return vRP.getUserSource { identifier }
end

function Framework.AddMoney(identifier, amount, reason)
    identifier = tonumber(identifier)
    vRP.giveMoney({ identifier, amount })
end

function Framework.RegisterCommand(name, description, callback, group)
    RegisterCommand(name, function(source)
        local identifier = Framework.GetPlayerIdentifier(source)
        local level = vRP.getUserAdminLevel({ identifier })

        if group == 'admin' and level < 5 then
            return
        end

        return callback(source)
    end, false)
end
```

{% endtab %}

{% tab title="STANDALONE" %}

```lua
Config.Framework = 'standalone' -- auto/qb-core/qbox/esx/vrp/standalone
```

```lua
if Config.Framework ~= 'standalone' then
    return
end

Framework = {}

function Framework.GetPlayerIdentifier(source)
    local identifiers, license = GetPlayerIdentifiers(source), ''

    for key, value in pairs(identifiers) do
        if string.match(value, 'license:') then
            license = value
            break
        end
    end

    return license
end

function Framework.GetSourceFromIdentifier(identifier)
    -- implement your code here
    return 1
end

function Framework.AddMoney(identifier, amount, reason)
    -- implement your code here
end

function Framework.RegisterCommand(name, description, callback, group)
    RegisterCommand(name, callback, false)
endConfig.Framework = 'auto'              -- qb-core/qbox/esx/vrp/custom
```

{% endtab %}
{% endtabs %}

### client/custom/framework

{% tabs %}
{% tab title="QB-CORE" %}

```lua
Config.Framework = 'qb-core' -- auto/qb-core/qbox/esx/vrp/standalone
```

```lua
if Config.Framework ~= 'qb-core' then
    return
end

Framework = {}

QBCore = exports['qb-core']:GetCoreObject()

function Framework.ProgressBar(message, time)
    QBCore.Functions.Progressbar('gang_activities_progress', message, time, false, true, {
        disableMovement = false,
        disableCarMovement = false,
        disableMouse = false,
        disableCombat = true,
    }, {}, {}, {})
    Wait(time)
end

function Framework.SetVehicleExtras(entity)
    SetVehicleFuelLevel(entity, 100.0);
    SetVehicleNumberPlateText(entity, 'LS' .. math.random(111111, 999999))
end

function Framework.setVehicleDoorsOpen(netId, entity, plate)
       TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys',plate)
end

function Framework.HideInterfaceForScene()
    -- your events to hide server interfaces for cutscenes
end

function Framework.ShowInterfaceAfterScene()
    -- your events to show again server interfaces for cutscenes
end

function Framework.DrawText3D(x, y, z, text)
    QBCore.Functions.DrawText3D(x, y, z, text)
end
```

{% endtab %}

{% tab title="QBOX" %}

```lua
Config.Framework = 'qbox' -- auto/qb-core/qbox/esx/vrp/standalone
```

```lua
if Config.Framework ~= 'qbox' then
    return
end

Framework = {}

function Framework.ProgressBar(message, time)
    lib.progressBar({
        duration = time,
        label = message
    })
end

function Framework.SetVehicleExtras(entity)
    SetVehicleFuelLevel(entity, 100.0);
    SetVehicleNumberPlateText(entity, 'LS' .. math.random(111111, 999999))
end


function Framework.setVehicleDoorsOpen(netId, entity, plate)
    --    TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys',plate)
end


function Framework.HideInterfaceForScene()
    -- your events to hide server interfaces for cutscenes
end

function Framework.ShowInterfaceAfterScene()
    -- your events to show again server interfaces for cutscenes
end

function Framework.DrawText3D(x, y, z, text)
    SetTextScale(0.30, 0.30)
    SetTextFont(0)
    SetTextProportional(1)
    SetTextColour(255, 255, 255, 215)
    SetTextEntry("STRING")
    SetTextCentre(true)
    AddTextComponentString(text)
    SetDrawOrigin(x, y, z, 0)
    DrawText(0.0, 0.0)
    local factor = (string.len(text)) / 250
    DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
    ClearDrawOrigin()
end
```

{% endtab %}

{% tab title="ESX" %}

```lua
Config.Framework = 'esx' -- auto/qb-core/qbox/esx/vrp/standalone
```

```lua
if Config.Framework ~= 'esx' then
    return
end

Framework = {}

success, ESX = pcall(function()
    return exports['es_extended']:getSharedObject()
end)

if not success then
    while not ESX do
        TriggerEvent('esx:getSharedObject', function(object)
            ESX = object
        end)

        Wait(500)
    end
end

function Framework.ProgressBar(message, time)
    ESX.Progressbar(message, time, { FreezePlayer = false })
    Wait(time)
end

function Framework.SetVehicleExtras(entity)
    SetVehicleFuelLevel(entity, 100.0);
    SetVehicleNumberPlateText(entity, 'LS' .. math.random(111111, 999999))
end

function Framework.setVehicleDoorsOpen(netId, entity, plate)
       TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys',plate)
end

function Framework.HideInterfaceForScene()
    -- your events to hide server interfaces for cutscenes
end

function Framework.ShowInterfaceAfterScene()
    -- your events to show again server interfaces for cutscenes
end

function Framework.DrawText3D(x, y, z, text)
    ESX.Game.Utils.DrawText3D(vector3(x, y, z), text)
end
```

{% endtab %}

{% tab title="VRP" %}

```lua
Config.Framework = 'vrp' -- auto/qb-core/qbox/esx/vrp/standalone
```

```lua
if Config.Framework ~= 'vrp' then
    return
end

Framework = {}

function Framework.ProgressBar(message, time)
    exports['rprogress']:Start(message, time)
    -- set Wait(time) if you don't have sync for progressBar
    -- Wait(time)
end

function Framework.SetVehicleExtras(entity)
    SetVehicleFuelLevel(entity, 100.0);
    SetVehicleNumberPlateText(entity, 'LS' .. math.random(111111, 999999))
end

function Framework.setVehicleDoorsOpen(netId, entity, plate)
       TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys',plate)
end

function Framework.HideInterfaceForScene()
    -- your events to hide server interfaces for cutscenes
end

function Framework.ShowInterfaceAfterScene()
    -- your events to show again server interfaces for cutscenes
end

function Framework.DrawText3D(x, y, z, text)
    SetTextScale(0.30, 0.30)
    SetTextFont(0)
    SetTextProportional(1)
    SetTextColour(255, 255, 255, 215)
    SetTextEntry("STRING")
    SetTextCentre(true)
    AddTextComponentString(text)
    SetDrawOrigin(x, y, z, 0)
    DrawText(0.0, 0.0)
    local factor = (string.len(text)) / 250
    DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
    ClearDrawOrigin()
end
```

{% endtab %}

{% tab title="STANDALONE" %}

```lua
Config.Framework = 'standalone' -- auto/qb-core/qbox/esx/vrp/standalone
```

```lua
if Config.Framework ~= 'standalone' then
    return
end

Framework = {}

function Framework.ProgressBar(message, time)
    -- your progressbar
end

function Framework.SetVehicleExtras(entity)
    SetVehicleFuelLevel(entity, 100.0);
    SetVehicleNumberPlateText(entity, 'LS' .. math.random(111111, 999999))
end

function Framework.setVehicleDoorsOpen(netId, entity, plate)
    --    TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys',plate)
end


function Framework.HideInterfaceForScene()
    -- your events to hide server interfaces for cutscenes
end

function Framework.ShowInterfaceAfterScene()
    -- your events to show again server interfaces for cutscenes
end

function Framework.DrawText3D(x, y, z, text)
    SetTextScale(0.30, 0.30)
    SetTextFont(0)
    SetTextProportional(1)
    SetTextColour(255, 255, 255, 215)
    SetTextEntry("STRING")
    SetTextCentre(true)
    AddTextComponentString(text)
    SetDrawOrigin(x, y, z, 0)
    DrawText(0.0, 0.0)
    local factor = (string.len(text)) / 250
    DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
    ClearDrawOrigin()
end
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.redutzu.com/resources/gang-activities/guides/frameworks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
