OrigenNetwork
Docs

Custom · origen_quests

All custom files are excluded from CFX escrow encryption and are safe to edit.

text
custom/
├── cl_drawtext.lua    -- Client: interaction text UI (key prompt at locations)
├── cl_framework.lua   -- Client: framework, notifications, player data
└── sv_framework.lua   -- Server: framework, admin, inventory, integrations

custom/cl_drawtext.lua

Controls the text prompt displayed when a player is near a quest location.

DrawQuestText(key, text)

Called when the player enters the interaction radius of a location. Default implementation uses ox_lib textUI.

lua
function DrawQuestText(key, text)
    lib.showTextUI("[" .. key .. "] - " .. text)
end
ParameterTypeDescription
keystringKey label to show (e.g. E)
textstringInteraction label from the location config

HideQuestText()

Called when the player leaves the interaction radius.

lua
function HideQuestText()
    lib.hideTextUI()
end

Replace these functions to use any drawtext or textUI system.


custom/cl_framework.lua

Framework.GetLocalIdentifier()string | nil

Returns the local player's identifier (citizenid / license). Used for XP sync.

lua
function Framework.GetLocalIdentifier()
    -- qbx / qb
    local ok, p = pcall(function() return exports.qbx_core:GetPlayerData() end)
    return (ok and p) and p.citizenid or nil
end

Framework.GetPlayerData()table

Returns the full player data object from the framework. Used for UI metadata.

lua
function Framework.GetPlayerData()
    local ok, p = pcall(function() return exports.qbx_core:GetPlayerData() end)
    return (ok and p) and p or {}
end

Framework.NotifyClient(message, notifyType)

Sends a notification to the local client.

lua
function Framework.NotifyClient(message, notifyType)
    -- notifyType: 'inform' | 'success' | 'error' | 'warning'
    lib.notify({ description = message, type = notifyType })
end

Adapt this function when using Config.NotifySystem = 'custom' with a client event.

Framework.OnPlayerLoaded(callback)

Registers a callback that fires when the player finishes loading. Used to initialize quest data.

lua
function Framework.OnPlayerLoaded(callback)
    AddEventHandler('QBCore:Client:OnPlayerLoaded', callback)
end

Framework.TriggerCallback(name, cb, ...)

Wraps lib.callback for server callbacks. You normally do not need to modify this.

Framework.GetPlayerGang()string

Returns the player's current gang name or "none".

Framework.GetPlayerBusinesses()table

Returns the player's active businesses from statebag.


custom/sv_framework.lua

Framework.GetPlayer(source)table | nil

Returns the framework player object for the given source.

lua
function Framework.GetPlayer(source)
    local ok, p = pcall(function() return exports.qbx_core:GetPlayer(src) end)
    return (ok and p) and p or nil
end

Framework.GetIdentifier(source)string | nil

Returns the player's unique identifier (citizenid for QB, license for ESX/standalone).

Framework.HasAdminPermission(source)boolean

Checks if a player has admin access. Resolution order based on Config.AdminSystem:

  1. origen_admin — checks origen_admin permission "origen_quests"
  2. ace — checks IsPlayerAceAllowed(source, Config.AdminAceNode)
  3. license — checks Config.AdminLicenses list
  4. custom — calls Config.AdminCustom.resource:Config.AdminCustom.hasPermission(source, permission)
  5. qb — checks player group (god, superadmin, admin)
  6. esx — checks player group (superadmin, admin)

Framework.Notify(source, message, ntype)

Sends a notification to a player server-side.

Framework.HasItem(source, item, amount)boolean

Checks if the player has at least amount of item. Auto-detects inventory system.

Framework.AddItem(source, item, amount)boolean

Adds items to the player's inventory. Returns true on success.

Framework.RemoveItem(source, item, amount)boolean

Removes items from the player's inventory. Returns true on success.

Framework.GetItems()table

Returns all registered items from the active inventory system. Used to populate the admin item picker.

Framework.GetItemByName(source, itemName)table

Returns item data (with count/amount) for a specific player.

Framework.GetItemMetadata(itemName)table

Returns item metadata (name, label, image, description) by item name.


Integration hooks

These functions are called by the core script to resolve integrations. Override them in sv_framework.lua for full control.

Framework.GetPlayerAffiliationsCustom(source)table | nil

Called when Config.Integrations.affiliations.mode = 'custom'. Must return:

lua
return {
    gang      = "mafia",       -- string, gang name or "none"
    businesses = { "auto_shop" }  -- table of business IDs
}

Framework.GetGangsCustom()table

Called when Config.Integrations.gangs.mode = 'custom'. Must return an array:

lua
return {
    { id = "mafia",  label = "Mafia" },
    { id = "ballas", label = "Ballas" },
}

Framework.GetBusinessesCustom()table

Called when Config.Integrations.businesses.mode = 'custom'. Must return an array:

lua
return {
    { id = "auto_shop", label = "Auto Shop", grades = { "owner", "manager" } },
}

Framework.SendPoliceDispatchCustom(source, data)boolean

Called when Config.Integrations.dispatch.mode = 'custom'. Receives:

lua
-- data = { message = "...", title = "..." }
-- Return true if the alert was sent successfully.
function Framework.SendPoliceDispatchCustom(_source, _data)
    exports['my_dispatch']:SendAlert(_source, _data)
    return true
end

Framework.CreateLog(data)

Called internally when admin actions occur. Forwards to origen_admin if running, falls back to SendDiscordLog event.