OrigenNetwork
Docs

Custom · origen_reports

text
custom/
└── server.lua

custom/** is listed in escrow_ignore, so it is fully editable. Every function is server-side and reads the auto-detected Config.Framework, Config.Inventory, Config.Clothing and Config.Ambulance values. Add a new branch when your resource is not supported out of the box.

With ox_inventory, listing items, giving items and opening inventories are handled internally by the resource. Custom.getItemList, Custom.giveItem and Custom.openPlayerInventory are never called in that case, so editing them has no effect.


custom/server.lua

Custom.getIdentifier(source) → string | nil

Returns the unique identifier used to store reports and staff stats. Called whenever a player creates a report or a staff member is resolved.

FrameworkReturned value
qb-core / qbx_corePlayerData.citizenid
esxxPlayer.getIdentifier()
NoneThe license identifier
lua
Custom.getIdentifier = function(source)
    local player = getFrameworkPlayer(source)
 
    if Config.Framework == 'qb-core' or Config.Framework == 'qbx_core' then
        return player and player.PlayerData and player.PlayerData.citizenid or nil
    elseif Config.Framework == 'esx' then
        return player and player.getIdentifier and player.getIdentifier() or nil
    end
 
    return GetPlayerIdentifierByType(source, 'license')
end

Changing the identifier format after the resource has been in use orphans existing reports and staff stats, since they are keyed by this value.


Custom.hasConfigFullAccess(source) → boolean

Returns true when the player matches any permission in Config.StaffFullAccess.

Custom.hasConfigBasicAccess(source) → boolean

Returns true when the player matches any permission in Config.StaffBasicAccess.

Both go through the same internal check, applied to each permission of the list:

  1. ACE <permission> or group.<permission>.
  2. qbx_core — exports.qbx_core:HasPermission and GetPermission.
  3. qb-core — Framework.Functions.GetPermission.
  4. esx — xPlayer.getGroup() == permission.

Override them to plug in a custom permission system:

lua
Custom.hasConfigFullAccess = function(source)
    return exports['my_admin']:IsAdmin(source)
end
 
Custom.hasConfigBasicAccess = function(source)
    return exports['my_admin']:IsModerator(source)
end
ParameterTypeDescription
sourcenumberServer ID of the player

Custom.getStaffLevel(source) → 'full' | 'basic' | false

Resolves the access level of a player from the two functions above. Full access wins when both match. Returns false when the player is not staff by config (they can still be limited staff if they were added with a group from the admin panel).

lua
Custom.getStaffLevel = function(source)
    local hasBasic = Custom.hasConfigBasicAccess(source)
    local hasFull = Custom.hasConfigFullAccess(source)
 
    if hasBasic and hasFull then
        return 'full'
    end
 
    if hasBasic then
        return 'basic'
    end
 
    if hasFull then
        return 'full'
    end
 
    return false
end

Custom.getItemList() → table

Returns every registered item as { name, label }, sorted by label. Used to fill the item picker of the give items quick action and the allowed items list of staff groups.

InventorySource
qb-inventory / ps-inventoryFramework.Shared.Items
codem-inventoryexports['codem-inventory']:GetItemList()
qs-inventoryexports['qs-inventory']:GetItemList()
origen_inventoryexports.origen_inventory:Items()
core_inventoryFramework.Shared.Items, or Framework.Items() on ESX
tgiann-inventoryexports['tgiann-inventory']:GetItemList()
Any otherFramework.Shared.Items, or Framework.Items() on ESX

To add an inventory, return its item table through the local mapItemTable helper:

lua
elseif Config.Inventory == 'my_inventory' then
    return mapItemTable(exports['my_inventory']:GetItemList())

Custom.giveItem(source, item, count) → boolean

Gives an item to the reported player. Called by the give items quick action. Returns true on success by convention, although the resource does not read the return value.

ParameterTypeDescription
sourcenumberServer ID of the player receiving the item
itemstringItem name
countnumberAmount to give

qs-inventory and tgiann-inventory check CanCarryItem first and return false when the player cannot carry it. Inventories without a branch fall back to the framework: Functions.AddItem on QB/Qbox and addInventoryItem on ESX.

lua
elseif Config.Inventory == 'my_inventory' then
    if not exports['my_inventory']:CanCarryItem(source, item, count) then return false end
    return exports['my_inventory']:AddItem(source, item, count)

Custom.openPlayerInventory(source, target) → boolean

Opens the reported player's inventory to the staff member. Called by the inventory quick action. Returns false when the inventory is not supported.

ParameterTypeDescription
sourcenumberServer ID of the staff member
targetnumberServer ID of the player whose inventory is opened
InventoryCall
qb-inventoryOpenInventory(source, target)
ps-inventoryOpenInventoryById(source, target)
origen_inventoryOpenInventory(source, 'otherplayer', target)
core_inventoryopenInventory(source, 'stash-<identifier>', 'stash', ...)
tgiann-inventoryOpenInventoryById(source, target)
jpr-inventoryOpenInventory(source, identifier)

qs-inventory and codem-inventory have no branch here, so the inventory quick action returns false with them. Add their open call if you use one of them.


Custom.openClothingMenu(source) → boolean

Opens the clothing menu on the reported player. Called by the clothing quick action.

ClothingClient event
illenium-appearanceillenium-appearance:client:openClothingShopMenu
esx_skinesx_skin:openMenu
qb-clothing / fivem-appearance / rcore_clothingqb-clothing:client:openMenu
origen_clothingorigen_clothing:client:openOutfitMenu
lua
elseif Config.Clothing == 'my_clothing' then
    TriggerClientEvent('my_clothing:client:openMenu', source)
    return true

Custom.revivePlayer(source) → boolean

Revives the reported player. Called by the revive quick action.

AmbulanceCall
qb-ambulancejob / qbx_medicalClient event hospital:client:Revive
esx_ambulancejobServer event esx_ambulancejob:revive
wasabi_ambulanceServer event wasabi_ambulance:revivePlayer
None on ESXServer event esx_ambulancejob:revive
None on QB/QboxClient event hospital:client:Revive
lua
elseif Config.Ambulance == 'my_ambulance' then
    TriggerClientEvent('my_ambulance:client:revive', source)
    return true
ParameterTypeDescription
sourcenumberServer ID of the player to revive