]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/cmd.qc
Finish up work on timeout system, now has much cleaner functionality (though it still...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / cmd.qc
index 86ff171f0cb3730e19904adc743ddd7a030b150a..521db1a0ab1c5de878747c01bdc6e1185b56ade5 100644 (file)
@@ -1,28 +1,11 @@
 // =========================================================
 //  Server side networked commands code, reworked by Samual
-//  Last updated: December 11th, 2011
+//  Last updated: December 26th, 2011
 // =========================================================
 
-#define CC_REQUEST_COMMAND 1
-#define CC_REQUEST_USAGE 2
-
-.float cmd_floodtime;
-.float cmd_floodcount;
-.float checkfail;
-.float lms_spectate_warning;
-
-string MapVote_Suggest(string m);
-//void MapVote_SendPicture(float id)
-
-// move any necessary sprint statements to "print_to"
-
-// ============================
-//  Misc. Supporting Functions
-// ============================
-
 float SV_ParseClientCommand_floodcheck()
 {
-       if (timeoutStatus != 2) // if the game is not paused... but wait, doesn't that mean it could be dos'd by pausing it? eh? (old code)
+       if not(timeout_status) // not while paused
        {
                if(time <= (self.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
                {
@@ -47,28 +30,28 @@ void ClientCommand_autoswitch(float request, float argc)
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
-                       self.autoswitch = ("0" != argv(1));
+                       self.autoswitch = InterpretBoolean(argv(1));
                        sprint(self, strcat("^1autoswitch is currently turned ", (self.autoswitch ? "on" : "off"), ".\n"));
                        return; // never fall through to usage
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd autoswitch selection\n");
-                       sprint(self, "  Where 'selection' is 1 or 0 for on or off.\n"); 
+                       sprint(self, "  Where 'selection' controls if autoswitch is on or off.\n"); 
                        return;
                }
        }
 }
 
-void ClientCommand_checkfail(float request, string command) // used only by client side code
+void ClientCommand_checkfail(float request, string command) // internal command, used only by code
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        print(sprintf("CHECKFAIL: %s (%s) epically failed check %s\n", self.netname, self.netaddress, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1))));
                        self.checkfail = 1;
@@ -76,20 +59,20 @@ void ClientCommand_checkfail(float request, string command) // used only by clie
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
-                       sprint(self, "\nUsage:^3 cmd checkfail message\n");
+                       sprint(self, "\nUsage:^3 cmd checkfail <message>\n");
                        sprint(self, "  Where 'message' is the message reported by client about the fail.\n");
                        return;
                }
        }
 }
 
-void ClientCommand_clientversion(float request, float argc) // used only by client side code
+void ClientCommand_clientversion(float request, float argc) // internal command, used only by code
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        if(self.flags & FL_CLIENT)
                        {
@@ -114,7 +97,7 @@ void ClientCommand_clientversion(float request, float argc) // used only by clie
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd clientversion version\n");
                        sprint(self, "  Where 'version' is the game version reported by self.\n");
@@ -123,53 +106,11 @@ void ClientCommand_clientversion(float request, float argc) // used only by clie
        }
 }
 
-void ClientCommand_cvar_changes(float request)
+void ClientCommand_getmapvotepic(float request, float argc) // internal command, used only by code
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
-               {
-                       sprint(self, cvar_changes);
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 sv_cmd cvar_changes\n");
-                       sprint(self, "  No arguments required.\n");
-                       //sprint(self, "See also: ^2cvar_purechanges^7\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_cvar_purechanges(float request)
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
-               {
-                       sprint(self, cvar_purechanges);
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 sv_cmd cvar_purechanges\n");
-                       sprint(self, "  No arguments required.\n");
-                       //sprint(self, "See also: ^2cvar_changes^7\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_getmapvotepic(float request, float argc)
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        if(intermission_running)                                
                                MapVote_SendPicture(stof(argv(1)));
@@ -178,7 +119,7 @@ void ClientCommand_getmapvotepic(float request, float argc)
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd getmapvotepic mapid\n");
                        sprint(self, "  Where 'mapid' is the id number of the map to request an image of on the map vote selection menu.\n");
@@ -187,38 +128,11 @@ void ClientCommand_getmapvotepic(float request, float argc)
        }
 }
 
-void ClientCommand_info(float request, float argc)
-{      
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
-               {
-                       string command;
-                       
-                       command = builtin_cvar_string(strcat("sv_info_", argv(1))); 
-                       if(command)
-                               wordwrap_sprint(command, 1111); // why 1111?
-                       else
-                               sprint(self, "ERROR: unsupported info command\n");
-                               
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd info request\n");
-                       sprint(self, "  Where 'request' is the suffixed string appended onto the request for cvar.\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_join(float request)
+void ClientCommand_join(float request) // legacy
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        if(self.flags & FL_CLIENT)
                        {
@@ -245,7 +159,7 @@ void ClientCommand_join(float request)
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd join\n");
                        sprint(self, "  No arguments required.\n");
@@ -254,111 +168,11 @@ void ClientCommand_join(float request)
        }
 }
 
-void ClientCommand_ladder(float request)
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
-               {
-                       sprint(self, ladder_reply);
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd ladder\n");
-                       sprint(self, "  No arguments required.\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_lsmaps(float request)
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
-               {
-                       sprint(self, lsmaps_reply);
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd lsmaps\n");
-                       sprint(self, "  No arguments required.\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_lsnewmaps(float request)
+void ClientCommand_ready(float request) // todo: anti-spam for toggling readyness
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
-               {
-                       sprint(self, lsnewmaps_reply);
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd lsnewmaps\n");
-                       sprint(self, "  No arguments required.\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_maplist(float request)
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
-               {
-                       sprint(self, maplist_reply);
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd maplist\n");
-                       sprint(self, "  No arguments required.\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_rankings(float request)
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
-               {
-                       sprint(self, rankings_reply);
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd rankings\n");
-                       sprint(self, "  No arguments required.\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_ready(float request) 
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        if(self.flags & FL_CLIENT)
                        {
@@ -378,7 +192,7 @@ void ClientCommand_ready(float request)
                                                }
 
                                                // cannot reset the game while a timeout is active!
-                                               if(!timeoutStatus)
+                                               if not(timeout_status)
                                                        ReadyCount();
                                        } else {
                                                sprint(self, "^1Game has already been restarted\n");
@@ -389,7 +203,7 @@ void ClientCommand_ready(float request)
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd ready\n");
                        sprint(self, "  No arguments required.\n");
@@ -398,35 +212,11 @@ void ClientCommand_ready(float request)
        }
 }
 
-void ClientCommand_records(float request) // TODO: Isn't this flooding with the sprint messages? Old code, but perhaps bad?
+void ClientCommand_reportcvar(float request, float argc, string command)
 {      
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
-               {
-                       float i;
-                       
-                       for(i = 0; i < 10; ++i)
-                               sprint(self, records_reply[i]);
-                               
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd records\n");
-                       sprint(self, "  No arguments required.\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_reportcvar(float request, float argc, string command) // TODO: confirm this works
-{      
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        float tokens;
                        string s;
@@ -441,7 +231,7 @@ void ClientCommand_reportcvar(float request, float argc, string command) // TODO
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd reportcvar <cvar>\n");
                        sprint(self, "  Where 'cvar' is the cvar plus arguments to send to the server.\n");
@@ -454,14 +244,14 @@ void ClientCommand_say(float request, float argc, string command)
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        if(argc >= 2) { Say(self, FALSE, world, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); }
                        return; // never fall through to usage
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd say <message>\n");
                        sprint(self, "  Where 'message' is the string of text to say.\n");
@@ -474,14 +264,14 @@ void ClientCommand_say_team(float request, float argc, string command)
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        if(argc >= 2) { Say(self, TRUE, world, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); }
                        return; // never fall through to usage
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd say_team <message>\n");
                        sprint(self, "  Where 'message' is the string of text to say.\n");
@@ -490,11 +280,11 @@ void ClientCommand_say_team(float request, float argc, string command)
        }
 }
 
-void ClientCommand_selectteam(float request, float argc) // TODO: Update the messages for this command
+void ClientCommand_selectteam(float request, float argc)
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        float selection;
                        
@@ -536,7 +326,7 @@ void ClientCommand_selectteam(float request, float argc) // TODO: Update the mes
                }
 
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        //sprint(self, strcat( "selectteam none/red/blue/yellow/pink/auto - \"", argv(1), "\" not recognised\n" ) );
                        sprint(self, "\nUsage:^3 cmd selectteam team\n");
@@ -551,16 +341,16 @@ void ClientCommand_selfstuff(float request, string command)
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        stuffcmd(self, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
                        return; // never fall through to usage
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
-                       sprint(self, "\nUsage:^3 cmd selfstuff command\n");
+                       sprint(self, "\nUsage:^3 cmd selfstuff <command>\n");
                        sprint(self, "  Where 'command' is the string to be stuffed to your client.\n");
                        return;
                }
@@ -571,7 +361,7 @@ void ClientCommand_sentcvar(float request, float argc, string command)
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        float tokens;
                        string s;
@@ -586,7 +376,7 @@ void ClientCommand_sentcvar(float request, float argc, string command)
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd sentcvar <cvar>\n");
                        sprint(self, "  Where 'cvar' is the cvar plus arguments to send to the server.\n");
@@ -595,11 +385,11 @@ void ClientCommand_sentcvar(float request, float argc, string command)
        }
 }
 
-void ClientCommand_spectate(float request)
+void ClientCommand_spectate(float request) // legacy
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        if(self.flags & FL_CLIENT)
                        {
@@ -634,7 +424,7 @@ void ClientCommand_spectate(float request)
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd spectate\n");
                        sprint(self, "  No arguments required.\n");
@@ -647,14 +437,14 @@ void ClientCommand_suggestmap(float request, float argc)
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        sprint(self, strcat(MapVote_Suggest(argv(1)), "\n"));
                        return; // never fall through to usage
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd suggestmap map\n");
                        sprint(self, "  Where 'map' is the name of the map to suggest.\n");
@@ -663,185 +453,51 @@ void ClientCommand_suggestmap(float request, float argc)
        }
 }
 
-void ClientCommand_teamstatus(float request)
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
-               {
-                       Score_NicePrint(self);
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd teamstatus\n");
-                       sprint(self, "  No arguments required.\n");
-                       return;
-               }
-       }
-}
-
 void ClientCommand_tell(float request, float argc, string command)
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
-                       entity e = GetCommandPlayerSlotTargetFromTokenizedCommand(argc, 1);
-                       
-                       if(e && argc > ParseCommandPlayerSlotTarget_firsttoken)
-                       {
-                               Say(self, FALSE, e, substring(command, argv_start_index(ParseCommandPlayerSlotTarget_firsttoken), argv_end_index(-1) - argv_start_index(ParseCommandPlayerSlotTarget_firsttoken)), TRUE);
-                       }
-                       else
-                       {
-                               if(argc > ParseCommandPlayerSlotTarget_firsttoken)
-                                       trigger_magicear_processmessage_forallears(self, -1, world, substring(command, argv_start_index(ParseCommandPlayerSlotTarget_firsttoken), argv_end_index(-1) - argv_start_index(ParseCommandPlayerSlotTarget_firsttoken)));
-                       }
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd tell playerid <message>\n");
-                       sprint(self, "  Where 'playerid' is the entity number of the player to send the 'message' to.\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_timein(float request)
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
-               {
-                       if(self.flags & FL_CLIENT)
+                       if(argc >= 3)
                        {
-                               if(autocvar_sv_timeout)
+                               entity tell_to = GetFilteredEntity(argv(1));
+                               float tell_accepted = VerifyClientEntity(tell_to, TRUE, FALSE);
+                               
+                               if(tell_accepted > 0) // the target is a real client
                                {
-                                       if (!timeoutStatus)
-                                               return sprint(self, "^7Error: There is no active timeout which could be aborted!\n");
-                                       if (self != timeoutInitiator)
-                                               return sprint(self, "^7Error: You may not abort the active timeout. Only the player who called it can do that!\n");
-                                               
-                                       if (timeoutStatus == 1) 
-                                       {
-                                               remainingTimeoutTime = timeoutStatus = 0;
-                                               timeoutHandler.nextthink = time; //timeoutHandler has to take care of it immediately
-                                               bprint(strcat("^7The timeout was aborted by ", self.netname, " !\n"));
-                                       }
-                                       else if (timeoutStatus == 2) 
+                                       if(tell_to != self) // and we're allowed to send to them :D
                                        {
-                                               //only shorten the remainingTimeoutTime if it makes sense
-                                               if( remainingTimeoutTime > (autocvar_sv_timeout_resumetime + 1) ) 
-                                               {
-                                                       bprint(strcat("^1Attention: ^7", self.netname, " resumed the game! Prepare for battle!\n"));
-                                                       remainingTimeoutTime = autocvar_sv_timeout_resumetime;
-                                                       timeoutHandler.nextthink = time; //timeoutHandler has to take care of it immediately
-                                               }
-                                               else
-                                                       sprint(self, "^7Error: Your resumegame call was discarded!\n");
+                                               Say(self, FALSE, tell_to, substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)), TRUE);
+                                               return;
                                        }
+                                       else { print_to(self, "You can't ^2tell^7 a message to yourself."); return; }
                                }
-                       }
-                       return; // never fall through to usage
-               }
-                       
-               default:
-               case CC_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd timein\n");
-                       sprint(self, "  No arguments required.\n");
-                       return;
-               }
-       }
-}
-
-void ClientCommand_timeout(float request) // DEAR GOD THIS COMMAND IS TERRIBLE.
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
-               {
-                       if(self.flags & FL_CLIENT)
-                       {
-                               if(autocvar_sv_timeout) 
-                               {
-                                       if(self.classname == "player") 
-                                       {
-                                               if(votecalled)
-                                                       sprint(self, "^7Error: you can not call a timeout while a vote is active!\n");
-                                               else
-                                               {
-                                                       if (inWarmupStage && !g_warmup_allow_timeout)
-                                                               return sprint(self, "^7Error: You can not call a timeout in warmup-stage!\n");
-                                                       if (time < game_starttime )
-                                                               return sprint(self, "^7Error: You can not call a timeout while the map is being restarted!\n");
-                                                               
-                                                       if (timeoutStatus != 2) {
-                                                               //if the map uses a timelimit make sure that timeout cannot be called right before the map ends
-                                                               if (autocvar_timelimit) {
-                                                                       //a timelimit was used
-                                                                       float myTl;
-                                                                       myTl = autocvar_timelimit;
-
-                                                                       float lastPossibleTimeout;
-                                                                       lastPossibleTimeout = (myTl*60) - autocvar_sv_timeout_leadtime - 1;
-
-                                                                       if (lastPossibleTimeout < time - game_starttime)
-                                                                               return sprint(self, "^7Error: It is too late to call a timeout now!\n");
-                                                               }
-                                                       }
-                                                       
-                                                       //player may not call a timeout if he has no calls left
-                                                       if (self.allowedTimeouts < 1)
-                                                               return sprint(self, "^7Error: You already used all your timeout calls for this map!\n");
-                                                               
-                                                               
-                                                       //now all required checks are passed
-                                                       self.allowedTimeouts -= 1;
-                                                       bprint(self.netname, " ^7called a timeout (", ftos(self.allowedTimeouts), " timeouts left)!\n"); //write a bprint who started the timeout (and how many he has left)
-                                                       remainingTimeoutTime = autocvar_sv_timeout_length;
-                                                       remainingLeadTime = autocvar_sv_timeout_leadtime;
-                                                       timeoutInitiator = self;
-                                                       if (timeoutStatus == 0) { //if another timeout was already active, don't change its status (which was 1 or 2) to 1, only change it to 1 if no timeout was active yet
-                                                               timeoutStatus = 1;
-                                                               //create the timeout indicator which centerprints the information to all players and takes care of pausing/unpausing
-                                                               timeoutHandler = spawn();
-                                                               timeoutHandler.think = timeoutHandler_Think;
-                                                       }
-                                                       timeoutHandler.nextthink = time; //always let the entity think asap
-
-                                                       //inform all connected clients about the timeout call
-                                                       Announce("timeoutcalled");
-                                               }
-                                       }
-                                       else
-                                               sprint(self, "^7Error: only players can call a timeout!\n");
+                               else if(strtolower(argv(1)) == "world") 
+                               { 
+                                       trigger_magicear_processmessage_forallears(self, -1, world, substring(command, argv_start_index(ParseCommandPlayerSlotTarget_firsttoken), argv_end_index(-1) - argv_start_index(ParseCommandPlayerSlotTarget_firsttoken)));
+                                       return;
                                }
+                               else { print_to(self, strcat("tell: ", GetClientErrorString(tell_accepted, argv(1)), ".")); return; }
                        }
-                       return; // never fall through to usage
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+                       sprint(self, "Incorrect parameters for ^2tell^7\n");
+               case CMD_REQUEST_USAGE:
                {
-                       sprint(self, "\nUsage:^3 cmd timeout\n");
-                       sprint(self, "  No arguments required.\n");
+                       sprint(self, "\nUsage:^3 cmd tell client <message>\n");
+                       sprint(self, "  Where 'client' is the entity number or name of the player to send 'message' to.\n");
                        return;
                }
        }
 }
 
-void ClientCommand_voice(float request, float argc, string command)
+void ClientCommand_voice(float request, float argc, string command) // legacy
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        if(argc >= 3)
                                VoiceMessage(argv(1), substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
@@ -851,92 +507,30 @@ void ClientCommand_voice(float request, float argc, string command)
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
-                       sprint(self, "\nUsage:^3 cmd voice\n");
-                       sprint(self, "  FIXME ARGUMENTS UNKNOWN.\n");
+                       sprint(self, "\nUsage:^3 cmd voice messagetype <soundname>\n");
+                       sprint(self, "  'messagetype' is the type of broadcast to do, like team only or such,\n");
+                       sprint(self, "  and 'soundname' is the string/filename of the sound/voice message to play.\n");
                        return;
                }
        }
 }
 
-string strlimitedlen(string input, float strip_colors, float limit)
-{
-       if(strlen((strip_colors ? strdecolorize(input) : input)) <= limit)
-               return input;
-       else
-               return strcat(substring(input, 0, (strlen(input) - 3)), "...");
-}
-
-void ClientCommand_who(float request)
-{
-       switch(request)
-       {
-               case CC_REQUEST_COMMAND:
-               {
-                       float total_listed_players, tmp_hours, tmp_minutes, tmp_seconds;
-                       entity tmp_player;
-                       string tmp_player_name;
-                       
-                       sprint(self, strcat("List of client information", (autocvar_sv_status_privacy ? " (some data is hidden for privacy)" : string_null), ":\n"));
-                       sprint(self, sprintf(" %-4s %-20s %-5s %-3s %-9s %-16s %s\n", "ent", "nickname", "ping", "pl", "time", "ip", "crypto_id"));
-                       
-                       FOR_EACH_CLIENT(tmp_player)
-                       {
-                               tmp_player_name = strlimitedlen(tmp_player.netname, TRUE, 20);
-                               
-                               tmp_hours = tmp_minutes = tmp_seconds = 0;
-                               
-                               tmp_seconds = (time - tmp_player.jointime);
-                               tmp_minutes = (tmp_seconds / 60);
-                               
-                               if(tmp_minutes)
-                               {
-                                       tmp_seconds -= (tmp_minutes * 60);
-                                       tmp_hours = (tmp_minutes / 60);
-                                       
-                                       if(tmp_hours) { tmp_minutes -= (tmp_hours * 60); }
-                               }
-                               
-                               sprint(self, sprintf(" %-4s %-20s %-5d %-3d %-9s %-16s %s\n", 
-                                       strcat("#", ftos(num_for_edict(tmp_player))), 
-                                       tmp_player.netname, //strcat(tmp_player_name, sprintf("%*s", (20 - strlen(strdecolorize(tmp_player_name))), "")),
-                                       tmp_player.ping, tmp_player.ping_packetloss, 
-                                       sprintf("%02d:%02d:%02d", tmp_hours, tmp_minutes, tmp_seconds),
-                                       (autocvar_sv_status_privacy ? "hidden" : tmp_player.netaddress),
-                                       (autocvar_sv_status_privacy ? "hidden" : tmp_player.crypto_idfp)));
-                                       
-                               ++total_listed_players;
-                       }
-                       
-                       sprint(self, strcat("Finished listing ", ftos(total_listed_players), " client(s). \n"));
-                       
-                       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.
+/* use this when creating a new command, making sure to place it in alphabetical order... also,
+** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION!
 void ClientCommand_(float request)
 {
        switch(request)
        {
-               case CC_REQUEST_COMMAND:
+               case CMD_REQUEST_COMMAND:
                {
                        
                        return; // never fall through to usage
                }
                        
                default:
-               case CC_REQUEST_USAGE:
+               case CMD_REQUEST_USAGE:
                {
                        sprint(self, "\nUsage:^3 cmd \n");
                        sprint(self, "  No arguments required.\n");
@@ -952,22 +546,23 @@ void ClientCommand_(float request)
 // =====================================
 
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
+// Common commands have double indentation to separate them a bit.
 #define CLIENT_COMMANDS(request,arguments,command) \
        CLIENT_COMMAND("autoswitch", ClientCommand_autoswitch(request, arguments), "Whether or not to switch automatically when getting a better weapon") \
        CLIENT_COMMAND("checkfail", ClientCommand_checkfail(request, command), "Report if a client-side check failed") \
        CLIENT_COMMAND("clientversion", ClientCommand_clientversion(request, arguments), "Release version of the game") \
-       CLIENT_COMMAND("cvar_changes", ClientCommand_cvar_changes(request), "Prints a list of all changed server cvars") \
-       CLIENT_COMMAND("cvar_purechanges", ClientCommand_cvar_purechanges(request), "Prints a list of all changed gameplay cvars") \
+               CLIENT_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, self), "Prints a list of all changed server cvars") \
+               CLIENT_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, self), "Prints a list of all changed gameplay cvars") \
        CLIENT_COMMAND("getmapvotepic", ClientCommand_getmapvotepic(request, arguments), "Retrieve mapshot picture from the server") \
-       CLIENT_COMMAND("info", ClientCommand_info(request, arguments), "Request for unique server information set up by admin") \
+               CLIENT_COMMAND("info", CommonCommand_info(request, self, arguments), "Request for unique server information set up by admin") \
        CLIENT_COMMAND("join", ClientCommand_join(request), "Become a player in the game") \
-       CLIENT_COMMAND("ladder", ClientCommand_ladder(request), "Get information about top players if supported") \
-       CLIENT_COMMAND("lsmaps", ClientCommand_lsmaps(request), "List maps which can be used with the current game mode") \
-       CLIENT_COMMAND("lsnewmaps", ClientCommand_lsnewmaps(request), "List maps which TODO") \
-       CLIENT_COMMAND("maplist", ClientCommand_maplist(request), "Full server maplist reply") \
-       CLIENT_COMMAND("rankings", ClientCommand_rankings(request), "Print information about rankings") \
+               CLIENT_COMMAND("ladder", CommonCommand_ladder(request, self), "Get information about top players if supported") \
+               CLIENT_COMMAND("lsmaps", CommonCommand_lsmaps(request, self), "List maps which can be used with the current game mode") \
+               CLIENT_COMMAND("lsnewmaps", CommonCommand_lsnewmaps(request, self), "List maps which have no records or are seemingly unplayed yet") \
+               CLIENT_COMMAND("maplist", CommonCommand_maplist(request, self), "Display full server maplist reply") \
+               CLIENT_COMMAND("rankings", CommonCommand_rankings(request, self), "Print information about rankings") \
        CLIENT_COMMAND("ready", ClientCommand_ready(request), "Qualify as ready to end warmup stage (or restart server if allowed)") \
-       CLIENT_COMMAND("records", ClientCommand_records(request), "List top 10 records for the current map") \
+               CLIENT_COMMAND("records", CommonCommand_records(request, self), "List top 10 records for the current map") \
        CLIENT_COMMAND("reportcvar", ClientCommand_reportcvar(request, arguments, command), "Old system for sending a client cvar to the server") \
        CLIENT_COMMAND("say", ClientCommand_say(request, arguments, command), "Print a message to chat to all players") \
        CLIENT_COMMAND("say_team", ClientCommand_say_team(request, arguments, command), "Print a message to chat to all team mates") \
@@ -976,13 +571,14 @@ void ClientCommand_(float request)
        CLIENT_COMMAND("sentcvar", ClientCommand_sentcvar(request, arguments, command), "New system for sending a client cvar to the server") \
        CLIENT_COMMAND("spectate", ClientCommand_spectate(request), "Become an observer") \
        CLIENT_COMMAND("suggestmap", ClientCommand_suggestmap(request, arguments), "Suggest a map to the mapvote at match end") \
-       CLIENT_COMMAND("teamstatus", ClientCommand_teamstatus(request), "Print detailed score information for all players") \
+               CLIENT_COMMAND("teamstatus", CommonCommand_teamstatus(request, self), "Show information about player and team scores") \
        CLIENT_COMMAND("tell", ClientCommand_tell(request, arguments, command), "Send a message directly to a player") \
-       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("time", CommonCommand_time(request, self), "Print different formats/readouts of time") \
+               CLIENT_COMMAND("timein", CommonCommand_timein(request, self), "Resume the game from being paused with a timeout") \
+               CLIENT_COMMAND("timeout", CommonCommand_timeout(request, self), "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") \
-       CLIENT_COMMAND("who", ClientCommand_who(request), "Display detailed client information about all players") \
+               CLIENT_COMMAND("vote", VoteCommand(request, self, arguments, command), "Request an action to be voted upon by players") \
+               CLIENT_COMMAND("who", CommonCommand_who(request, self, arguments), "Display detailed client information about all players") \
        /* nothing */
        
 void ClientCommand_macro_help()
@@ -1001,7 +597,7 @@ float ClientCommand_macro_command(float argc, string command)
        #define CLIENT_COMMAND(name,function,description) \
                { if(name == strtolower(argv(0))) { function; return TRUE; } }
                
-       CLIENT_COMMANDS(CC_REQUEST_COMMAND, argc, command)
+       CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
        #undef CLIENT_COMMAND
        
        return FALSE;
@@ -1012,7 +608,7 @@ float ClientCommand_macro_usage(float argc, string command)
        #define CLIENT_COMMAND(name,function,description) \
                { if(name == strtolower(argv(1))) { function; return TRUE; } }
                
-       CLIENT_COMMANDS(CC_REQUEST_USAGE, argc, command)
+       CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc, command)
        #undef CLIENT_COMMAND
        
        return FALSE;
@@ -1028,11 +624,17 @@ void SV_ParseClientCommand(string command)
 {
        float argc = tokenize_console(command);
        
+       // Guide for working with argc arguments by example:
+       // argc:   1    - 2      - 3     - 4
+       // argv:   0    - 1      - 2     - 3 
+       // cmd     vote - master - login - password
+       
        // for floodcheck
        switch(strtolower(argv(0)))
        {
                // exempt commands which are not subject to floodcheck
                case "begin": break; // handled by engine in host_cmd.c
+               case "download": break; // handled by engine in cl_parse.c
                case "getmapvotepic": break; // handled by server in this file
                case "pause": break; // handled by engine in host_cmd.c
                case "prespawn": break; // handled by engine in host_cmd.c
@@ -1044,10 +646,10 @@ void SV_ParseClientCommand(string command)
                        if(SV_ParseClientCommand_floodcheck())
                                break; // "TRUE": continue, as we're not flooding yet
                        else
-                               return; // "FALSE": not allowed to continue, halt
+                               return print("^1ERROR: ^7ANTISPAM CAUGHT: ", command, ".\n"); // "FALSE": not allowed to continue, halt
        }
        
-       /* NOTE: totally disabled for now, however the functionality and descriptions are there if we ever want it.
+       /* NOTE: totally disabled for now for bandwidth/security reasons, however the functionality and descriptions are there if we ever want it.
        if(argv(0) == "help") 
        {
                if(argc == 1) 
@@ -1072,7 +674,7 @@ void SV_ParseClientCommand(string command)
        }
        else if(ClientCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
        {
-               return; // handled by one of the above GameCommand_* functions
+               return; // handled by one of the above ClientCommand_* functions
        }
        else
                clientcommand(self, command);