Inicio › Documentación › Personalización · origen_doorlock

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.

text
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 logging

custom/client/framework.lua

Framework.GetPlayerIdentifier() → string | nil

Devuelve el identificador único del jugador local (citizenid / identifier).

lua
Framework.GetPlayerIdentifier = function()
    -- Config.Framework == 'custom': implement here
    return nil
end

Framework.GetPlayerJob() → string

Devuelve el nombre del trabajo actual del jugador local.

lua
Framework.GetPlayerJob = function()
    return 'unemployed'
end

Framework.GetPlayerJobGroup() → number

Devuelve el nivel de rango del trabajo del jugador local.

lua
Framework.GetPlayerJobGroup = function()
    return 0
end

Framework.GetPlayerGang() → string

Devuelve el nombre de la banda del jugador local. Por defecto devuelve 'none'.

lua
Framework.GetPlayerGang = function()
    return 'none'
end

Framework.GetPlayerGangGrade() → number

Devuelve el rango de banda del jugador local. Por defecto devuelve 0.

lua
Framework.GetPlayerGangGrade = function()
    return 0
end

custom/client/notify.lua

Custom.Notify(text, type, length)

Muestra una notificación al jugador local.

lua
Custom.Notify = function(text, type, length)
    -- Add your custom notification here
end

Compatibles 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.

lua
Custom.DrawText = function(text, key)
    -- Add your custom draw text here
end

Custom.HideText()

Oculta el texto de indicación de interacción.

lua
Custom.HideText = function()
    -- Add your custom hide text here
end

custom/server/framework.lua

Framework.GetGroup(source) → string

Devuelve el grupo de permisos del jugador (p. ej. 'admin', 'god').

lua
Framework.GetGroup = function(source)
    -- Config.Framework == 'custom': implement here
    return 'user'
end

Framework.GetIdentifier(source) → string | nil

Devuelve el identificador único del jugador en el servidor.

lua
Framework.GetIdentifier = function(source)
    return nil
end

custom/server/permissions.lua

Custom.hasPermission(source) → boolean

Comprueba 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).

lua
Custom.hasPermission = function(src)
    -- Default: checks Config.GroupPermissions via framework group + ace permissions
    -- To override:
    return false
end

custom/server/logs.lua

Custom.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'.

lua
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)
end

Los 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