From eae2080bff293f9b07df61df4b5a6dc0494169d3 Mon Sep 17 00:00:00 2001 From: Samual Date: Tue, 6 Dec 2011 15:37:44 -0500 Subject: [PATCH] Beginning of "who" command which lists extra detailed information about each player --- qcsrc/server/clientcommands.qc | 29 +++++++++++++++++++++++++++-- qcsrc/server/gamecommand.qc | 4 ++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/qcsrc/server/clientcommands.qc b/qcsrc/server/clientcommands.qc index 19921aae4..df6f7b4e7 100644 --- a/qcsrc/server/clientcommands.qc +++ b/qcsrc/server/clientcommands.qc @@ -1,6 +1,6 @@ // ========================================================= // Server side networked commands code, reworked by Samual -// Last updated: November 30th, 2011 +// Last updated: December 6th, 2011 // ========================================================= #define CC_REQUEST_COMMAND 1 @@ -838,6 +838,30 @@ void ClientCommand_voice(float request, float argc, string command) } } +void ClientCommand_who(float request) +{ + switch(request) + { + case CC_REQUEST_COMMAND: + { + entity tmp_player; + FOR_EACH_CLIENT(tmp_player) + { + sprint(self, sprintf("%-20s%-5f.\n", tmp_player.netname, tmp_player.ping)); + } + return; // never fall through to usage + } + + default: + case CC_REQUEST_USAGE: + { + sprint(self, "\nUsage:^3 cmd who\n"); + sprint(self, " No arguments required.\n"); + return; + } + } +} + /* use this when creating a new command, making sure to place it in alphabetical order. void ClientCommand_(float request) { @@ -894,7 +918,8 @@ void ClientCommand_(float request) CLIENT_COMMAND("timein", ClientCommand_timein(request), "Resume the game from being paused with a timeout") \ CLIENT_COMMAND("timeout", ClientCommand_timeout(request), "Call a timeout which pauses the game for certain amount of time unless unpaused") \ CLIENT_COMMAND("voice", ClientCommand_voice(request, arguments, command), "Send voice message via sound") \ - CLIENT_COMMAND("vote", VoteCommand(request, self, arguments, command), "Request an action to be voted upon by players") /* handled in server/vote.qc */ \ + CLIENT_COMMAND("vote", VoteCommand(request, self, arguments, command), "Request an action to be voted upon by players") \ + CLIENT_COMMAND("who", ClientCommand_who(request), "Display detailed client information about all players") \ /* nothing */ void ClientCommand_macro_help() diff --git a/qcsrc/server/gamecommand.qc b/qcsrc/server/gamecommand.qc index 0a28ddbf5..7d24f2e5a 100644 --- a/qcsrc/server/gamecommand.qc +++ b/qcsrc/server/gamecommand.qc @@ -1,6 +1,6 @@ // ===================================================== // Server side game commands code, reworked by Samual -// Last updated: November 30th, 2011 +// Last updated: December 6th, 2011 // ===================================================== #define GC_REQUEST_COMMAND 1 @@ -113,7 +113,7 @@ void modelbug() // Command Sub-Functions // ======================= -void GameCommand_adminmsg(float request, float argc) +void GameCommand_adminmsg(float request, float argc) // todo: re-write this, plus support multiple clients at once like moveplayer { switch(request) { -- 2.39.2