Inicio › Documentación › Personalización · origen_chat
La carpeta custom/ te permite integrar cualquier framework, sistema de notificaciones o filtro del chat sin tocar el núcleo. Todos los ficheros son escrow_ignore, así que se conservan al actualizar.
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 checkCustom.GetPlayerJob() → { name, label?, grade: { name, level } }Devuelve el trabajo actual del jugador local. Delega en Config.Framework.
Custom.GetPlayerJob = function()
-- 'qb-core' / 'qbx_core' → Framework.Functions.GetPlayerData().job
-- 'esx' → Framework.GetPlayerData().job (normalized)
-- 'standalone' → { name = 'unknown', grade = { name = 'unknown', level = 0 } }
endCustom.Notify(text, type, length)Muestra una notificación al jugador local. Se llama cuando Config.CustomNotify = true.
Custom.Notify = function(text, type, length)
lib.notify({
description = text,
type = type, -- 'info' | 'success' | 'error'
duration = length,
})
endCustom.CanOpenChat() → booleanControla si el jugador local puede abrir la entrada del chat. Devuelve false para bloquearla (p. ej. durante una cinemática).
Custom.CanOpenChat = function()
return true
endCustom.OnSendNoCommandMessage(playerId, message)Se llama cuando un jugador envía un mensaje que no empieza por /. Implementa aquí tu propio gestor de mensajes sin comando.
Custom.OnSendNoCommandMessage = function(playerId, message)
-- Example: route to a default /say command
-- TriggerServerEvent('origen_chat:server:say', message)
end| Función | Devuelve | Descripción |
|---|---|---|
Custom.GetIdentifier(source) |
string | nil |
Identificador único del jugador |
Custom.GetPlayerName(source) |
string |
Nombre completo del jugador o 'Unknown' |
Custom.GetPlayerJob(source) |
{ name, label, grade } |
Trabajo y rango del jugador |
Custom.GetGroup(source) |
string | table |
Grupo de permisos del jugador |
Todas las funciones delegan automáticamente según Config.Framework (qb-core, qbx_core, esx, standalone).
Custom.hasPermission(source, permissions) → boolean, stringComprueba si un jugador pertenece a alguno de los grupos de permisos indicados. Lo usan los comandos que tienen el campo permissions en Config.Commands.
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