Inicio › Documentación › Personalización · origen_clothing
La carpeta custom/ te permite integrar cualquier framework, notificación o lógica de acceso a las tiendas sin tocar el núcleo. Todos los ficheros son escrow_ignore, así que se conservan al actualizar.
custom/
├── client/
│ ├── framework.lua — player identifier, job, gender, loaded state
│ ├── notify.lua — notifications and text UI
│ ├── store.lua — gate who can open a store
│ └── visuals.lua — hide/show HUD when clothing menu opens
└── server/
├── framework.lua — player identifier, job, money, permissions, group, gender
└── permissions.lua — admin checkCustom.GetPlayerIdentifier() → string | nilDevuelve el identificador único del jugador local (citizenid / identifier).
Custom.GetPlayerIdentifier = function()
-- Config.Framework == 'custom': implement here
return nil
endCustom.GetJob() → { name, grade }Devuelve el nombre del trabajo actual del jugador local y su nivel de rango.
Custom.GetJob = function()
return { name = 'unemployed', grade = 0 }
endFramework.GetGender() → numberDevuelve el género del jugador local. 0 = hombre, 1 = mujer.
Framework.GetGender = function()
-- Config.Framework == 'custom': implement here
endFramework.isPlayerLoaded() → booleanDevuelve true cuando los datos del jugador están listos y cargados.
Framework.isPlayerLoaded = function()
return false
endCustom.Notify(text, type, length)Muestra una notificación al jugador local.
Custom.Notify = function(text, type, length)
lib.notify({
description = text,
type = type, -- 'info' | 'success' | 'error'
duration = length,
})
endCustom.DrawText(text, key)Muestra una indicación de interacción con text UI.
Custom.DrawText = function(text, key)
lib.showTextUI('[' .. key .. '] - ' .. text)
endCustom.HideText()Oculta la indicación de text UI.
Custom.HideText = function()
lib.hideTextUI()
endCustom.CanOpenStore(storeId) → booleanControla si el jugador local puede abrir una tienda concreta. Se llama antes de abrir la interfaz de la tienda.
Custom.CanOpenStore = function(storeId)
-- Example: only allow police job to open store ID 1
-- if storeId == 1 then
-- return Custom.GetJob().name == 'police'
-- end
return true
endCustom.HideVisuals(state)Se llama cuando se abre el menú de ropa (state = true) o se cierra (state = false). Úsala para ocultar o mostrar tu HUD, radar, minimapa, etc.
Custom.HideVisuals = function(state)
-- Example:
-- DisplayRadar(not state)
-- SendNUIMessage({ type = 'hud', visible = not state })
endCustom.GetIdentifier(source) → string | nilDevuelve el identificador único de un jugador en el servidor.
Custom.GetIdentifier = function(source)
-- Config.Framework == 'custom': implement here
return nil
endCustom.GetMoney(source, paymentMethod) → numberDevuelve el saldo del jugador para el método de pago indicado. Si el método no es válido, usa Config.DefaultPaymentMethod.
Custom.GetMoney = function(source, paymentMethod)
return 0
endCustom.RemoveMoney(source, amount, paymentMethod)Descuenta dinero de la cuenta del jugador.
Custom.RemoveMoney = function(source, amount, paymentMethod)
endCustom.GetJob(source) → { name, grade }Devuelve el trabajo y el rango actuales del jugador en el servidor.
Custom.GetJob = function(source)
return { name = 'unemployed', grade = 0 }
endCustom.GetGroup(source) → stringDevuelve el grupo de permisos del jugador (p. ej. 'admin', 'god').
Custom.GetGroup = function(source)
return 'user'
endCustom.GetGender(source) → number | stringDevuelve el género del jugador en el servidor. 0 / 'm' = hombre, 1 / 'f' = mujer.
Custom.GetGender = function(source)
return 0
endCustom.HasPermission(source, group) → booleanComprueba si un jugador pertenece a un grupo de permisos.
Custom.HasPermission = function(source, group)
return false
endCustom.IsAdmin(source) → booleanComprueba si un jugador se considera administrador según Config.Permissions. Recorre la lista y llama a Custom.HasPermission con cada grupo. Si Config.Permissions está vacío, todos los jugadores se consideran administradores.
Custom.IsAdmin = function(src)
-- Default logic: checks each group in Config.Permissions
-- To override:
return false
end