OrigenNetwork
Docs

Custom · origen_chat

The custom/ folder lets you integrate any framework, notification system or chat gate without touching the core. All files are escrow_ignore — they survive updates.

text
custom/
├── client/
│   ├── framework.lua   — player job (client-side)
│   ├── notify.lua      — notifications
│   └── chat.lua        — chat open gate, raw message hook
└── server/
    ├── framework.lua   — player identifier, name, job, group
    └── permissions.lua — permission check

custom/client/framework.lua

Custom.GetPlayerJob(){ name, label?, grade: { name, level } }

Returns the local player's current job. Dispatches to Config.Framework.

lua
Custom.GetPlayerJob = function()
    -- 'qb-core' / 'qbx_core' → Framework.Functions.GetPlayerData().job
    -- 'esx'                   → Framework.GetPlayerData().job (normalized)
    -- 'standalone'            → { name = 'unknown', grade = { name = 'unknown', level = 0 } }
end

custom/client/notify.lua

Custom.Notify(text, type, length)

Show a notification to the local player. Called when Config.CustomNotify = true.

lua
Custom.Notify = function(text, type, length)
    lib.notify({
        description = text,
        type        = type,     -- 'info' | 'success' | 'error'
        duration    = length,
    })
end

custom/client/chat.lua

Custom.CanOpenChat()boolean

Gate whether the local player can open the chat input. Return false to block it (e.g. during a cutscene).

lua
Custom.CanOpenChat = function()
    return true
end

Custom.OnSendNoCommandMessage(playerId, message)

Called when a player sends a message that does not start with /. Implement your own no-command chat handler here.

lua
Custom.OnSendNoCommandMessage = function(playerId, message)
    -- Example: route to a default /say command
    -- TriggerServerEvent('origen_chat:server:say', message)
end

custom/server/framework.lua

FunctionReturnsDescription
Custom.GetIdentifier(source)string | nilPlayer unique identifier
Custom.GetPlayerName(source)stringPlayer full name or 'Unknown'
Custom.GetPlayerJob(source){ name, label, grade }Player job and grade
Custom.GetGroup(source)string | tablePlayer permission group

All functions dispatch automatically based on Config.Framework (qb-core, qbx_core, esx, standalone).


custom/server/permissions.lua

Custom.hasPermission(source, permissions)boolean, string

Check if a player belongs to any of the given permission groups. Used by commands with a permissions field in Config.Commands.

lua
Custom.hasPermission = function(source, permissions)
    -- permissions: array of group names (e.g. { 'admin', 'god' })
    -- returns: true if the player's group is in the list
end