Início › Documentação › Personalização · origen_clothing
A pasta custom/ permite-te integrar qualquer framework, notificação ou lógica de acesso às lojas sem mexer no núcleo. Todos os ficheiros são escrow_ignore, por isso mantêm-se após as atualizações.
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 | nilDevolve o identificador único do jogador local (citizenid / identifier).
Custom.GetPlayerIdentifier = function()
-- Config.Framework == 'custom': implement here
return nil
endCustom.GetJob() → { name, grade }Devolve o nome do trabalho atual do jogador local e o respetivo nível de grau.
Custom.GetJob = function()
return { name = 'unemployed', grade = 0 }
endFramework.GetGender() → numberDevolve o género do jogador local. 0 = masculino, 1 = feminino.
Framework.GetGender = function()
-- Config.Framework == 'custom': implement here
endFramework.isPlayerLoaded() → booleanDevolve true quando os dados do jogador estão prontos e carregados.
Framework.isPlayerLoaded = function()
return false
endCustom.Notify(text, type, length)Mostra uma notificação ao jogador local.
Custom.Notify = function(text, type, length)
lib.notify({
description = text,
type = type, -- 'info' | 'success' | 'error'
duration = length,
})
endCustom.DrawText(text, key)Mostra uma indicação de interação com text UI.
Custom.DrawText = function(text, key)
lib.showTextUI('[' .. key .. '] - ' .. text)
endCustom.HideText()Oculta a indicação de text UI.
Custom.HideText = function()
lib.hideTextUI()
endCustom.CanOpenStore(storeId) → booleanControla se o jogador local pode abrir uma loja específica. É chamada antes de abrir a interface da loja.
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)É chamada quando o menu de roupa abre (state = true) ou fecha (state = false). Usa-a para ocultar ou mostrar o teu HUD, radar, minimapa, etc.
Custom.HideVisuals = function(state)
-- Example:
-- DisplayRadar(not state)
-- SendNUIMessage({ type = 'hud', visible = not state })
endCustom.GetIdentifier(source) → string | nilDevolve o identificador único de um jogador no servidor.
Custom.GetIdentifier = function(source)
-- Config.Framework == 'custom': implement here
return nil
endCustom.GetMoney(source, paymentMethod) → numberDevolve o saldo do jogador para o método de pagamento indicado. Se o método for inválido, usa Config.DefaultPaymentMethod.
Custom.GetMoney = function(source, paymentMethod)
return 0
endCustom.RemoveMoney(source, amount, paymentMethod)Desconta dinheiro da conta do jogador.
Custom.RemoveMoney = function(source, amount, paymentMethod)
endCustom.GetJob(source) → { name, grade }Devolve o trabalho e o grau atuais do jogador no servidor.
Custom.GetJob = function(source)
return { name = 'unemployed', grade = 0 }
endCustom.GetGroup(source) → stringDevolve o grupo de permissões do jogador (p. ex. 'admin', 'god').
Custom.GetGroup = function(source)
return 'user'
endCustom.GetGender(source) → number | stringDevolve o género do jogador no servidor. 0 / 'm' = masculino, 1 / 'f' = feminino.
Custom.GetGender = function(source)
return 0
endCustom.HasPermission(source, group) → booleanVerifica se um jogador pertence a um grupo de permissões.
Custom.HasPermission = function(source, group)
return false
endCustom.IsAdmin(source) → booleanVerifica se um jogador é considerado administrador com base em Config.Permissions. Percorre a lista e chama Custom.HasPermission para cada grupo. Se Config.Permissions estiver vazio, todos os jogadores são considerados administradores.
Custom.IsAdmin = function(src)
-- Default logic: checks each group in Config.Permissions
-- To override:
return false
end