Inicio › Documentación › Personalización · origen_doorlock
La carpeta custom/ te permite integrar cualquier framework, sistema de notificaciones o lógica de logs sin tocar el núcleo. Todos los ficheros son escrow_ignore, así que se conservan al actualizar.
custom/
├── client/
│ ├── framework.lua — player identifier, job, gang
│ └── notify.lua — notifications, draw text, hide text
└── server/
├── framework.lua — player group, identifier
├── permissions.lua — admin/permission check
└── logs.lua — Discord webhook loggingFramework.GetPlayerIdentifier() → string | nilDevuelve el identificador único del jugador local (citizenid / identifier).
Framework.GetPlayerIdentifier = function()
-- Config.Framework == 'custom': implement here
return nil
endFramework.GetPlayerJob() → stringDevuelve el nombre del trabajo actual del jugador local.
Framework.GetPlayerJob = function()
return 'unemployed'
endFramework.GetPlayerJobGroup() → numberDevuelve el nivel de rango del trabajo del jugador local.
Framework.GetPlayerJobGroup = function()
return 0
endFramework.GetPlayerGang() → stringDevuelve el nombre de la banda del jugador local. Por defecto devuelve 'none'.
Framework.GetPlayerGang = function()
return 'none'
endFramework.GetPlayerGangGrade() → numberDevuelve el rango de banda del jugador local. Por defecto devuelve 0.
Framework.GetPlayerGangGrade = function()
return 0
endCustom.Notify(text, type, length)Muestra una notificación al jugador local.
Custom.Notify = function(text, type, length)
-- Add your custom notification here
endCompatibles de serie: qb-core (Framework.Functions.Notify) y esx (Framework.ShowNotification).
Custom.DrawText(text, key)Muestra un texto de indicación de interacción (p. ej. [E] - Open door).
Compatibles mediante Config.Drawtext: qb-core, esx_textui, ox_lib.
Custom.DrawText = function(text, key)
-- Add your custom draw text here
endCustom.HideText()Oculta el texto de indicación de interacción.
Custom.HideText = function()
-- Add your custom hide text here
endFramework.GetGroup(source) → stringDevuelve el grupo de permisos del jugador (p. ej. 'admin', 'god').
Framework.GetGroup = function(source)
-- Config.Framework == 'custom': implement here
return 'user'
endFramework.GetIdentifier(source) → string | nilDevuelve el identificador único del jugador en el servidor.
Framework.GetIdentifier = function(source)
return nil
endCustom.hasPermission(source) → booleanComprueba si un jugador tiene permiso para usar los comandos de gestión de puertas. Valida contra Config.GroupPermissions usando tanto los grupos del framework como los permisos Ace de FiveM (IsPlayerAceAllowed).
Custom.hasPermission = function(src)
-- Default: checks Config.GroupPermissions via framework group + ace permissions
-- To override:
return false
endCustom.DiscordLog(title, message, webHook)Envía un log con un embed de Discord a la URL de webhook indicada. Se omite automáticamente si el webhook está vacío o es el marcador por defecto 'YOUR_DISCORD_WEBHOOK'.
Custom.DiscordLog = function(title, message, webHook)
-- Default implementation sends a Discord embed via PerformHttpRequest
-- To use a different logging system, replace this function:
print('[DoorLock] ' .. title .. ': ' .. message)
endLos tres webhooks se configuran en Config.Logs:
| Webhook | Se lanza cuando |
|---|---|
Config.Logs.CreateDoor |
Se crea una puerta nueva desde el menú de gestión |
Config.Logs.DeleteDoor |
Se elimina una puerta desde el menú de gestión |
Config.Logs.DoorsUsage |
Un jugador bloquea o desbloquea una puerta |