the minutes displayed would go negative which was unintended

This commit is contained in:
jenz 2026-04-14 15:16:49 +02:00
parent 778fdd2f7a
commit b4c4b11c3d

View File

@ -477,6 +477,11 @@ public Action Command_Knifestatus(int client, int args)
int iTimeRemaining = length_hours - timesinceknifeban; int iTimeRemaining = length_hours - timesinceknifeban;
int iTimeRemaining_minutes = length_minutes - timesinceknifeban_minutes; int iTimeRemaining_minutes = length_minutes - timesinceknifeban_minutes;
if (iTimeRemaining_minutes < 0)
{
iTimeRemaining_minutes += 60;
iTimeRemaining--;
}
Format(sTimeRemaining, sizeof(sTimeRemaining), "%d Hours and %d minutes playtime", iTimeRemaining, iTimeRemaining_minutes); Format(sTimeRemaining, sizeof(sTimeRemaining), "%d Hours and %d minutes playtime", iTimeRemaining, iTimeRemaining_minutes);
CReplyToCommand(client, "\x07%s[KnifeBan] \x07%s%N\x07%s is currently knifebanned for another \x07%s%s\x07%s.", "E01B5D", "EDEDED", target, "F16767", "EDEDED", sTimeRemaining, "F16767"); CReplyToCommand(client, "\x07%s[KnifeBan] \x07%s%N\x07%s is currently knifebanned for another \x07%s%s\x07%s.", "E01B5D", "EDEDED", target, "F16767", "EDEDED", sTimeRemaining, "F16767");
@ -534,6 +539,11 @@ public Action Command_Knifestatus(int client, int args)
int iTimeRemaining = length_hours - timesinceknifeban; int iTimeRemaining = length_hours - timesinceknifeban;
int iTimeRemaining_minutes = length_minutes - timesinceknifeban_minutes; int iTimeRemaining_minutes = length_minutes - timesinceknifeban_minutes;
if (iTimeRemaining_minutes < 0)
{
iTimeRemaining_minutes += 60;
iTimeRemaining--;
}
Format(sTimeRemaining, sizeof(sTimeRemaining), "%d Hours and %d minutes playtime", iTimeRemaining, iTimeRemaining_minutes); Format(sTimeRemaining, sizeof(sTimeRemaining), "%d Hours and %d minutes playtime", iTimeRemaining, iTimeRemaining_minutes);
CReplyToCommand(client, "\x07%s[KnifeBan] \x07%sYou are currently knifebanned for another \x07%s%s\x07%s.", "E01B5D", "F16767", "EDEDED", sTimeRemaining, "F16767"); CReplyToCommand(client, "\x07%s[KnifeBan] \x07%sYou are currently knifebanned for another \x07%s%s\x07%s.", "E01B5D", "F16767", "EDEDED", sTimeRemaining, "F16767");