OrigenNetwork
Docs

Custom · origen_boosting

All files inside the custom/ folder are open source (escrow-ignored) and are the integration layer between origen_boosting and your server's specific resources.

text
custom/
├── client/
│   ├── framework.lua
│   ├── functions.lua
│   ├── inventory.lua
│   └── notify.lua
└── server/
    ├── framework.lua
    ├── functions.lua
    ├── inventory.lua
    └── vinscratch.lua

custom/client/framework.lua

Handles how the script reads player data on the client side, depending on the active framework.

Framework._GetPlayerData()table

Returns the full player data object from the active framework.

lua
Framework._GetPlayerData = function()
    if Config.Framework == 'qb-core' or Config.Framework == 'qbx_core' then
        return Framework.Functions.GetPlayerData()
    elseif Config.Framework == 'esx' then
        return Framework.GetPlayerData()
    end
end

Framework.GetIdentifier()string

Returns the unique player identifier (citizenid for QBCore/QBX, identifier for ESX).

lua
Framework.GetIdentifier = function()
    if Config.Framework == 'qb-core' or Config.Framework == 'qbx_core' then
        return Framework.Functions.GetPlayerData().citizenid
    elseif Config.Framework == 'esx' then
        return Framework.GetPlayerData().identifier
    end
end

custom/client/functions.lua

Contains gameplay integration hooks that are called during active missions.

Custom.GiveKeys(plate)

Called when the player successfully steals a vehicle. Implement your key system integration here.

ParameterTypeDescription
platestringLicense plate of the stolen vehicle
lua
Custom.GiveKeys = function(plate)
    -- Example using qb-vehiclekeys
    exports['qb-vehiclekeys']:GiveKeys(plate)
end

Custom.Minigame()boolean

Called when the player must complete the hacking minigame. Must return true on success or false on failure.

By default, uses origen_hacking. Replace with your preferred minigame resource.

lua
Custom.Minigame = function()
    local status = exports['origen_hacking']:createGame("alphabet", 30)
    return status
end

Custom.SendDispatch(data)

Called when a mission event should trigger a police dispatch notification.

ParameterTypeDescription
data.coordsvector3Location of the event
data.vehiclenumberEntity handle of the vehicle
lua
Custom.SendDispatch = function(data)
    local plate = GetVehicleNumberPlateText(data.vehicle)
    exports['ps-dispatch']:CustomAlert({
        coords = data.coords,
        message = 'Vehicle being stolen - ' .. plate,
        dispatchCode = '10-37',
        job = { 'police' },
    })
end

Custom.VehicleDestroy(veh)

Called when the server signals that the mission vehicle should be destroyed. By default, adds a 20-second warning and then triggers an explosion.

ParameterTypeDescription
vehnumberEntity handle of the vehicle to destroy
lua
Custom.VehicleDestroy = function(veh)
    Internal.Notify(locale('in_game.notifications.vehicle_explosion', 20))
    SetTimeout(20000, function()
        if DoesEntityExist(veh) then
            AddExplosion(GetEntityCoords(veh), 0, 100.0, true, false, true)
        end
    end)
end

Custom.IsOnDuty

Controls whether on-duty state is evaluated before allowing a player to start a mission.

Set to false (default) to disable the check, or assign a function that returns boolean.

lua
-- Default: no duty check
Custom.IsOnDuty = false
 
-- Example: integrate with origen_police
Custom.IsOnDuty = function()
    return exports['origen_police']:IsOnDuty()
end

custom/client/notify.lua

Handles all client-side notifications, UI text prompts, and progress indicators.

Custom.Notify(text, type, length)

Displays a notification to the player. Called when Config.CustomNotify is true or when using a custom framework.

ParameterTypeDescription
textstringNotification message
typestringNotification type: 'success', 'error', 'info', 'warning'
lengthnumberDuration in milliseconds
lua
Custom.Notify = function(text, type, length)
    lib.notify({
        description = text,
        type = type,
        duration = length,
    })
end

Custom.DrawText(key, text)

Displays a contextual text UI hint on screen.

ParameterTypeDescription
keystringKey label shown to the player
textstringDescription text
lua
Custom.DrawText = function(key, text)
    lib.showTextUI('[' .. key .. '] - ' .. text)
end

Custom.HideText()

Hides the text UI hint.

lua
Custom.HideText = function()
    lib.hideTextUI()
end

Custom.Progress(duration, text)boolean

Displays a progress circle. Returns true when completed.

ParameterTypeDescription
durationnumberDuration in milliseconds
textstringLabel displayed below the progress circle
lua
Custom.Progress = function(duration, text)
    return lib.progressCircle({
        canCancel = false,
        disable = { car = true },
        duration = duration,
        label = text,
        position = 'bottom',
        useWhileDead = false,
    })
end

custom/server/framework.lua

Handles all server-side framework operations such as player lookups, money management, and job queries.

Framework.GetIdentifier(source)string | false

Returns the unique identifier for a player by server id.

ParameterTypeDescription
sourcenumberPlayer server id

Framework.HasPermission(source, group)boolean

Checks if a player belongs to a specific admin group.

ParameterTypeDescription
sourcenumberPlayer server id
groupstringGroup name to check against

Framework.GetPlayerData(source)table

Returns the raw player object from the active framework.

ParameterTypeDescription
sourcenumberPlayer server id

Framework.GetMoney(source, account)number

Returns the balance of a money account for the given player.

ParameterTypeDescription
sourcenumberPlayer server id
accountstringAccount name (e.g. 'bank', 'cash')

Framework.RemoveMoney(source, account, amount)boolean

Deducts money from a player's account. Returns true if successful.

ParameterTypeDescription
sourcenumberPlayer server id
accountstringAccount name
amountnumberAmount to remove

Framework.AddMoney(source, account, amount)boolean

Adds money to a player's account.

ParameterTypeDescription
sourcenumberPlayer server id
accountstringAccount name
amountnumberAmount to add

Framework.AddOfflineMoney(identifier, account, amount)

Adds money to an offline player's account using their identifier.

ParameterTypeDescription
identifierstringPlayer identifier (citizenid or license)
accountstringAccount name
amountnumberAmount to add

Framework.GetPlayerByIdentifier(identifier)table | nil

Looks up an online player by their unique identifier.

ParameterTypeDescription
identifierstringPlayer identifier (citizenid or license)

Framework.GetPlayersInJob(jobName)number

Returns the count of online players currently holding the specified job.

ParameterTypeDescription
jobNamestringJob name to count

custom/server/functions.lua

Custom.PlateGenerator

Optional override for the built-in plate generation logic. Set to a function that returns a plate string, or leave as false to use the default generator configured via Config.PlatePattern.

lua
-- Default: use built-in generator
Custom.PlateGenerator = false
 
-- Custom example
Custom.PlateGenerator = function()
    return 'CUSTOM' .. math.random(10, 99)
end

custom/server/inventory.lua

Custom.AddItem(source, name, amount, slot, metadata)boolean

Called when the script needs to give an item to a player. Implement this when your inventory system is not natively supported or when you need custom logic.

Returns true if the item was successfully added, false otherwise.

ParameterTypeDescription
sourcenumberPlayer server id
namestringItem name
amountnumberQuantity
slotnumber | nilTarget inventory slot (optional)
metadatatable | nilItem metadata (optional)
lua
Custom.AddItem = function(source, name, amount, slot, metadata)
    exports['ox_inventory']:AddItem(source, name, amount, metadata)
    return true
end

custom/server/vinscratch.lua

Handles the logic for saving a VIN-scratched vehicle to the database when a player completes the VIN scratch interaction.

This callback is registered as origen_boosting:sv:saveVinVehicle and fires when the client requests to save the vehicle after completing the VIN scratch mission step.

Adapt the SQL queries here if your vehicle table structure differs from the default QBCore or ESX schema.

lua
lib.callback.register('origen_boosting:sv:saveVinVehicle', function(source, props, model)
    local table = (Config.Framework == 'qb-core' or Config.Framework == 'qbx_core')
        and 'player_vehicles'
        or 'owned_vehicles'
 
    local identifier = Framework.GetIdentifier(source)
 
    -- QBCore / QBX
    if Config.Framework == 'qb-core' or Config.Framework == 'qbx_core' then
        MySQL.Async.execute(
            'INSERT INTO ' .. table .. ' (license, citizenid, vehicle, hash, mods, plate, vin) VALUES (@license, @citizenid, @vehicle, @hash, @mods, @plate, @vin)',
            {
                license = GetPlayerIdentifierByType(source, 'license'),
                citizenid = identifier,
                vehicle = model,
                hash = GetHashKey(model),
                mods = json.encode(props),
                plate = props.plate,
                vin = 1,
            }
        )
    end
end)