From a0b2e59357761c0532964b2863d3dc78bab05199 Mon Sep 17 00:00:00 2001 From: Valentin Barat Date: Thu, 25 Apr 2024 00:47:54 +0200 Subject: [PATCH] Better duration check --- Commands/basebans.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Commands/basebans.cs b/Commands/basebans.cs index d1fe77c..42ef54c 100644 --- a/Commands/basebans.cs +++ b/Commands/basebans.cs @@ -382,16 +382,19 @@ namespace CS2_SimpleAdmin { bool validCaller = caller != null && caller.IsValid; - if (duration > Config.MaxBanDuration) + bool canPermBan = validCaller && AdminManager.PlayerHasPermissions(caller, "@css/permban"); + + if (duration > Config.MaxBanDuration && canPermBan == false) { if (validCaller) caller.PrintToChat($"[Simple Admin] Ban duration cannot exceed {Config.MaxBanDuration} minutes."); return false; } - if (duration == 0 && validCaller && AdminManager.PlayerHasPermissions(caller, "@css/permban") == false) + if (duration == 0 && canPermBan == false) { - caller.PrintToChat($"[Simple Admin] You do not have the right to permanently ban."); + if (validCaller) + caller.PrintToChat($"[Simple Admin] You do not have the right to permanently ban."); return false; }