Início › Documentação › Personalização · origen_garages
A pasta custom/ permite-te integrar qualquer framework, sistema de notificações, sistema de combustível ou sincronização de meteorologia sem tocar no núcleo. Todos os ficheiros aqui são escrow_ignore: sobrevivem às atualizações.
custom/
├── client/
│ ├── framework.lua — player identifier, job, gang, loaded state
│ ├── keys.lua — give vehicle keys on retrieval
│ ├── fuel.lua — get/set fuel level
│ ├── notify.lua — notifications and text UI
│ └── weather.lua — disable/enable weather sync inside interiors
└── server/
└── framework.lua — player identifier, job, money, permissions, nameFramework.GetPlayerIdentifier(source) → string | nilDevolve o identificador único (citizenid / identifier) de um jogador no servidor.
Framework.GetPlayerIdentifier = function(source)
-- Config.Framework == 'custom': implement here
endFramework.GetPlayerJob(source) → { name, grade }Devolve o nome do trabalho e o grau de um jogador.
Framework.GetPlayerJob = function(source)
-- returns { name = 'police', grade = 2 }
endFramework.GetMoney(source) → numberDevolve o saldo do jogador para Config.PaymentMethod.
Framework.GetMoney = function(source)
-- Config.PaymentMethod = 'bank' | 'cash'
endFramework.RemoveMoney(source, account, amount) → booleanDesconta dinheiro da conta do jogador. Devolve true se for bem-sucedido.
Framework.RemoveMoney = function(source, account, amount)
endFramework.HasPermission(source, group) → booleanVerifica se um jogador pertence a um grupo de permissões. O painel de administração usa-o com Config.Permissions.
Framework.HasPermission = function(source, group)
endFramework.GetPlayerName(source) → stringDevolve o nome completo do jogador (nome + apelido).
Framework.GetPlayerName = function(source)
endFramework.GetPlayerIdentifier() → string | nilDevolve o identificador único do jogador local.
Framework.GetPlayerIdentifier = function()
-- Config.Framework == 'custom': implement here
endFramework.GetPlayerJob() → { name, grade }Devolve o trabalho atual do jogador local.
Framework.GetPlayerJob = function()
return { name = 'unknown', grade = 0 }
endFramework.GetPlayerGang() → { name, grade }Devolve a gangue atual do jogador local. Por omissão devolve unknown.
Framework.GetPlayerGang = function()
return { name = 'unknown', grade = 0 }
endFramework.isPlayerLoaded() → booleanDevolve true quando os dados do jogador estão prontos e carregados.
Framework.isPlayerLoaded = function()
return false -- replace with your check
endCustom.GiveVehicleKeys(vehicle, plate)Dá as chaves do veículo ao jogador local depois de o retirar. Implementa aqui o teu sistema de chaves.
Custom.GiveVehicleKeys = function(vehicle, plate)
-- Example with qbx_vehiclekeys:
-- exports['qbx_vehiclekeys']:GiveKeys(vehicle, true)
endCustom.GetFuel / Custom.SetFuelPor omissão ambas valem false (desativadas: usa-se o combustível nativo). Atribui-lhes funções para usares um sistema de combustível próprio:
Custom.GetFuel = function(vehicle)
return exports['fuel-system']:GetFuel(vehicle)
end
Custom.SetFuel = function(vehicle, fuelLevel)
exports['fuel-system']:SetFuel(vehicle, fuelLevel)
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 dica de interação na interface de texto.
Custom.DrawText = function(text, key)
lib.showTextUI('[' .. key .. '] - ' .. text)
endCustom.HideText()Esconde a dica de interação.
Custom.HideText = function()
lib.hideTextUI()
endCustom.DisableWeatherSync() / Custom.EnableWeatherSync()São chamadas quando o jogador entra ou sai de um interior de garagem. Usa-as para pausar ou retomar o teu recurso de sincronização de meteorologia, para que não substitua a meteorologia estática do interior.
Custom.DisableWeatherSync = function()
-- Example: TriggerEvent('your_weather:pause')
end
Custom.EnableWeatherSync = function()
-- Example: TriggerEvent('your_weather:resume')
end