From 1aedca5b52d6a4296354501e480e3af7122a8e86 Mon Sep 17 00:00:00 2001 From: Samual Date: Thu, 29 Dec 2011 23:53:07 -0500 Subject: [PATCH] Add proper usage support for bans plus also show total number of bans and such prints with the banlist command --- qcsrc/server/command/sv_cmd.qc | 6 +++++- qcsrc/server/ipban.qc | 13 +++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 7c234002d..8cfaf3884 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1766,7 +1766,11 @@ void GameCommand(string command) return; } - else if(CommonCommand_macro_usage(argc, world)) // Instead of trying to call a command, we're going to see detailed information about it + else if(BanCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it + { + return; + } + else if(CommonCommand_macro_usage(argc, world)) // same here, but for common commands instead { return; } diff --git a/qcsrc/server/ipban.qc b/qcsrc/server/ipban.qc index 77bc1d6a2..b40a1e3a2 100644 --- a/qcsrc/server/ipban.qc +++ b/qcsrc/server/ipban.qc @@ -317,17 +317,26 @@ void Ban_LoadBans() void Ban_View() { - float i; + float i, n; string msg; + + print("^2Listing all existing active bans:\n"); + for(i = 0; i < ban_count; ++i) { if(time > ban_expire[i]) continue; + + ++n; // total number of existing bans + msg = strcat("#", ftos(i), ": "); msg = strcat(msg, ban_ip[i], " is still banned for "); msg = strcat(msg, ftos(ban_expire[i] - time), " seconds"); - print(msg, "\n"); + + print(" ", msg, "\n"); } + + print("^2Done listing all active (", ftos(n), ") bans.\n"); } float Ban_GetClientIP(entity client) -- 2.39.2