corrected wrong logic for ban durations

This commit is contained in:
jenz 2026-01-27 21:00:09 +01:00
parent 41b775f611
commit 29971e96fc

View File

@ -116,7 +116,7 @@ public void OnClientPostAdminCheck(int client)
if(length == -1) if(length == -1)
g_bKnifeBanned[client] = true; g_bKnifeBanned[client] = true;
else if(length > 0) else if(length > 0 || length_minutes > 0)
CheckIfClientIsStillKnifeBanned(sAuth, client, time, time_minutes, length, length_minutes); CheckIfClientIsStillKnifeBanned(sAuth, client, time, time_minutes, length, length_minutes);
} }
@ -167,7 +167,7 @@ public Action CheckKnifeBans(Handle timer)
time_minutes = Banlist.GetNum("time_minutes", 0); time_minutes = Banlist.GetNum("time_minutes", 0);
} }
if(length > 0) if(length > 0 || length_minutes > 0)
CheckIfClientIsStillKnifeBanned(sAuth, i, time, time_minutes, length, length_minutes); CheckIfClientIsStillKnifeBanned(sAuth, i, time, time_minutes, length, length_minutes);
} }
} }
@ -185,12 +185,12 @@ public void CheckIfClientIsStillKnifeBanned(char sAuth[32], int client, int time
timesinceknifeban_minutes += 60; timesinceknifeban_minutes += 60;
timesinceknifeban--; timesinceknifeban--;
} }
//PrintToChatAll("timesinceknifeban: %i. length: %i. timesinceknifeban_minutes: %i. length_minutes: %i", timesinceknifeban, length, timesinceknifeban_minutes, length_minutes);
if (timesinceknifeban < length) if (timesinceknifeban < length)
{ {
g_bKnifeBanned[client] = true; g_bKnifeBanned[client] = true;
} }
else if (timesinceknifeban == length && timesinceknifeban_minutes < length_minutes) else if (timesinceknifeban <= length && timesinceknifeban_minutes < length_minutes)
{ {
g_bKnifeBanned[client] = true; g_bKnifeBanned[client] = true;
} }