Inicio › Documentación › Personalización · origen_clothing

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.

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

custom/client/framework.lua

Custom.GetPlayerIdentifier() → string | nil

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

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

Custom.GetJob() → { name, grade }

Devuelve el nombre del trabajo actual del jugador local y su nivel de rango.

lua
Custom.GetJob = function()
    return { name = 'unemployed', grade = 0 }
end

Framework.GetGender() → number

Devuelve el género del jugador local. 0 = hombre, 1 = mujer.

lua
Framework.GetGender = function()
    -- Config.Framework == 'custom': implement here
end

Framework.isPlayerLoaded() → boolean

Devuelve true cuando los datos del jugador están listos y cargados.

lua
Framework.isPlayerLoaded = function()
    return false
end

custom/client/notify.lua

Custom.Notify(text, type, length)

Muestra una notificación al jugador local.

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

Custom.DrawText(text, key)

Muestra una indicación de interacción con text UI.

lua
Custom.DrawText = function(text, key)
    lib.showTextUI('[' .. key .. '] - ' .. text)
end

Custom.HideText()

Oculta la indicación de text UI.

lua
Custom.HideText = function()
    lib.hideTextUI()
end

custom/client/store.lua

Custom.CanOpenStore(storeId) → boolean

Controla si el jugador local puede abrir una tienda concreta. Se llama antes de abrir la interfaz de la tienda.

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

custom/client/visuals.lua

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

lua
Custom.HideVisuals = function(state)
    -- Example:
    -- DisplayRadar(not state)
    -- SendNUIMessage({ type = 'hud', visible = not state })
end

custom/server/framework.lua

Custom.GetIdentifier(source) → string | nil

Devuelve el identificador único de un jugador en el servidor.

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

Custom.GetMoney(source, paymentMethod) → number

Devuelve el saldo del jugador para el método de pago indicado. Si el método no es válido, usa Config.DefaultPaymentMethod.

lua
Custom.GetMoney = function(source, paymentMethod)
    return 0
end

Custom.RemoveMoney(source, amount, paymentMethod)

Descuenta dinero de la cuenta del jugador.

lua
Custom.RemoveMoney = function(source, amount, paymentMethod)
end

Custom.GetJob(source) → { name, grade }

Devuelve el trabajo y el rango actuales del jugador en el servidor.

lua
Custom.GetJob = function(source)
    return { name = 'unemployed', grade = 0 }
end

Custom.GetGroup(source) → string

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

lua
Custom.GetGroup = function(source)
    return 'user'
end

Custom.GetGender(source) → number | string

Devuelve el género del jugador en el servidor. 0 / 'm' = hombre, 1 / 'f' = mujer.

lua
Custom.GetGender = function(source)
    return 0
end

Custom.HasPermission(source, group) → boolean

Comprueba si un jugador pertenece a un grupo de permisos.

lua
Custom.HasPermission = function(source, group)
    return false
end

custom/server/permissions.lua

Custom.IsAdmin(source) → boolean

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

lua
Custom.IsAdmin = function(src)
    -- Default logic: checks each group in Config.Permissions
    -- To override:
    return false
end