Skip to content

Commit

Permalink
Feat: Permitir ativar/desativar whitelist pelo menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ggfto committed Dec 23, 2024
1 parent 000a9d4 commit c8875d3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
30 changes: 16 additions & 14 deletions client/creator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -459,20 +459,20 @@ local function ConfigWhitelist()
title = "Configurações da Whitelist",
onExit = OnExit,
options = {
-- {
-- title = "Ativar/Desativar",
-- description = string.format(
-- "Ativar ou desativar a Whitelist. Ativo: %s",
-- ifThen(Config.Enabled, "Sim", "Não")
-- ),
-- icon = ifThen(Config.Enabled, "toggle-on", "toggle-off"),
-- iconColor = ifThen(Config.Enabled, ColorScheme.success, ColorScheme.danger),
-- iconAnimation = Config.IconAnimation,
-- onSelect = ToggleWhitelist,
-- args = {
-- callback = ConfigWhitelist
-- }
-- },
{
title = "Ativar/Desativar",
description = string.format(
"Ativar ou desativar a Whitelist. Ativo: %s",
ifThen(Config.Enabled, "Sim", "Não")
),
icon = ifThen(Config.Enabled, "toggle-on", "toggle-off"),
iconColor = ifThen(Config.Enabled, ColorScheme.success, ColorScheme.danger),
iconAnimation = Config.IconAnimation,
onSelect = ToggleWhitelist,
args = {
callback = ConfigWhitelist
}
},
{
title = "Configurar Locais",
description = "Configurar os locais da Whitelist",
Expand Down Expand Up @@ -586,6 +586,7 @@ function manageCitizenship()
title = "Liberar Player",
description = "Liberar um player da Whitelist",
icon = "user-plus",
disabled = not Config.Enabled,
iconAnimation = Config.IconAnimation,
onSelect = AddWhitelist,
args = {
Expand All @@ -596,6 +597,7 @@ function manageCitizenship()
title = "Revogar Whitelist",
description = "Revogar a Whitelist de um player",
icon = "user-minus",
disabled = not Config.Enabled,
iconColor = ColorScheme.danger,
iconAnimation = Config.IconAnimation,
onSelect = RemoveWhitelist,
Expand Down
4 changes: 3 additions & 1 deletion client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ end
local function OnPlayerLoaded()
Config = lib.callback.await("mri_Qwhitelist:getConfig", false)
if not lib.callback.await("mri_Qwhitelist:checkCitizenship", false) then
loadCitizenship()
if Config.Enabled then
loadCitizenship()
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions server/config.sample.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Config = {
Enabled = false, -- Set to false to disable the entire system.
Percent = 70, -- Percentage of questions that need to be answered correctly to get citizenship.
Enabled = true, -- Coloque false para desativar a whitelist.
Percent = 70, -- Porcentagem de respostas corretas para liberar o player
loadNotify = 'Você deve completar o exame de cidadania para jogar!', -- Notification when player loads in without completing citizenship.
escapeNotify = 'Você deve completar o exame de cidadania para jogar!', -- Notification when player tries to leave citizenship office.
-- Labels for Exam:
Expand Down

0 comments on commit c8875d3

Please sign in to comment.