From 2c05a9763de043caddbeae369502b8ce0d23708d Mon Sep 17 00:00:00 2001 From: Samual Date: Sat, 24 Mar 2012 16:08:24 -0400 Subject: [PATCH] Add logic for mute and unmute commands --- qcsrc/server/command/banning.qc | 48 ++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/qcsrc/server/command/banning.qc b/qcsrc/server/command/banning.qc index cb878e75f..47e98413d 100644 --- a/qcsrc/server/command/banning.qc +++ b/qcsrc/server/command/banning.qc @@ -107,21 +107,36 @@ void BanCommand_kickban(float request, float argc, string command) } } -void BanCommand_mute(float request, float argc, string command) +void BanCommand_mute(float request, float argc, string command) // TODO: Add a sort of mute-"ban" which allows players to be muted based on IP/cryptokey { switch(request) { case CMD_REQUEST_COMMAND: { - - return; + if(argc >= 2) + { + entity client = GetFilteredEntity(argv(1)); + float accepted = VerifyClientEntity(client, TRUE, FALSE); + + if(accepted > 0) + { + client.muted = TRUE; + return; + } + else + { + print("mute: ", GetClientErrorString(accepted, argv(1)), ".\n"); + } + } } default: + print("Incorrect parameters for ^2mute^7\n"); case CMD_REQUEST_USAGE: { - print("\nUsage:^3 sv_cmd mute\n"); - print(" No arguments required.\n"); + print("\nUsage:^3 sv_cmd mute client\n"); + print(" 'client' is the entity number or name of the player to mute.\n"); + print("See also: ^2unmute^7\n"); return; } } @@ -157,15 +172,30 @@ void BanCommand_unmute(float request, float argc) { case CMD_REQUEST_COMMAND: { - - return; + if(argc >= 2) + { + entity client = GetFilteredEntity(argv(1)); + float accepted = VerifyClientEntity(client, TRUE, FALSE); + + if(accepted > 0) + { + client.muted = FALSE; + return; + } + else + { + print("unmute: ", GetClientErrorString(accepted, argv(1)), ".\n"); + } + } } default: + print("Incorrect parameters for ^2mute^7\n"); case CMD_REQUEST_USAGE: { - print("\nUsage:^3 sv_cmd unmute\n"); - print(" No arguments required.\n"); + print("\nUsage:^3 sv_cmd unmute client\n"); + print(" 'client' is the entity number or name of the player to unmute.\n"); + print("See also: ^2mute^7\n"); return; } } -- 2.39.2