]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/clientcommands.qc
Merge remote-tracking branch 'origin/master' into samual/updatecommands
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / clientcommands.qc
index c1d3162a5739da2da60f6604d6f4a72368414aaa..de37d377d38eb95a38810ec1483a5c8c4279c76a 100644 (file)
@@ -1,6 +1,50 @@
+// =======================================================
+//  Server side client commands code, reworked by Samual
+//  Last updated: August 4th, 2011
+// =======================================================
+
+#define CC_REQUEST_HELP 1
+#define CC_REQUEST_COMMAND 2
+#define CC_REQUEST_USAGE 3
+
 entity nagger;
+
+.float cmd_floodtime;
+.float cmd_floodcount;
+.float checkfail;
+.float lms_spectate_warning;
+
+float readyrestart_happened;
 float readycount;
 
+string MapVote_Suggest(string m);
+
+void ReadyCount();
+
+
+// ============================
+//  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(time == self.cmd_floodtime) // todo: add buffer time as well, ONLY one second is a short amount of time for someone to be spamming. 
+               {
+                       self.cmd_floodcount += 1;
+                       if(self.cmd_floodcount > 8) // todo: replace constant 8 with a cvar for the server to control
+                               return FALSE; // too much spam, halt
+               }
+               else
+               {
+                       self.cmd_floodtime = time;
+                       self.cmd_floodcount = 1;
+               }
+       }
+       return TRUE; // continue, as we're not flooding yet
+}
+
 float Nagger_SendEntity(entity to, float sendflags)
 {
        float nags, i, f, b;
@@ -88,349 +132,6 @@ void Nagger_ReadyCounted()
                nagger.SendFlags |= 1;
 }
 
-void ReadyCount();
-string MapVote_Suggest(string m);
-
-entity GetPlayer(string name)
-{
-       float num;
-       entity e;
-       string ns;
-
-       if(substring(name, 0, 1) == "#") {
-               num = stof(substring(name, 1, 999));
-               if(num >= 1 && num <= maxclients) {
-                       for((e = world); num > 0; --num, (e = nextent(e)))
-                               ;
-                       //if(clienttype(e) == CLIENTTYPE_REAL)
-                       if(e.classname == "player")
-                               return e;
-               }
-       } else {
-               ns = strdecolorize(name);
-               FOR_EACH_REALPLAYER(e) {
-                       if(!strcasecmp(strdecolorize(e.netname), ns)) {
-                               return e;
-                       }
-               }
-       }
-       return world;
-}
-
-//float ctf_clientcommand();
-float readyrestart_happened;
-.float lms_spectate_warning;
-void spawnfunc_func_breakable();
-
-.float cmd_floodtime;
-.float cmd_floodcount;
-float cmd_floodcheck()
-{
-       if (timeoutStatus != 2)
-       {
-               if(time == self.cmd_floodtime)
-               {
-                       self.cmd_floodcount += 1;
-                       if(self.cmd_floodcount > 8)
-                               return TRUE;
-               }
-               else
-               {
-                       self.cmd_floodtime = time;
-                       self.cmd_floodcount = 1;
-               }
-       }
-       return FALSE;
-}
-
-.float checkfail;
-void SV_ParseClientCommand(string s) {
-       string cmd;
-       float tokens;
-       float i;
-       entity e;
-
-       tokens = tokenize_console(s);
-
-       cmd = strtolower(argv(0));
-       if(cmd != "reportcvar")
-       if(cmd != "sentcvar")
-       if(cmd != "pause")
-       if(cmd != "prespawn")
-       if(cmd != "spawn")
-       if(cmd != "begin")
-       {
-               if(cmd_floodcheck())
-                       return;
-       }
-
-       if(GameCommand_Vote(s, self)) {
-               return;
-       } else if(GameCommand_MapVote(argv(0))) {
-               return;
-       } else if(cmd == "checkfail") {
-               print(sprintf("CHECKFAIL: %s (%s) epically failed check %s\n", self.netname, self.netaddress, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1))));
-               self.checkfail = 1;
-       } else if(cmd == "autoswitch") {
-               // be backwards compatible with older clients (enabled)
-               self.autoswitch = ("0" != argv(1));
-               local string autoswitchmsg;
-               if (self.autoswitch) {
-                       autoswitchmsg = "on";
-               } else {
-                       autoswitchmsg = "off";
-               }
-               sprint(self, strcat("^1autoswitch turned ", autoswitchmsg, "\n"));
-       } else if(cmd == "clientversion") {
-               if not(self.flags & FL_CLIENT)
-                       return;
-               if (argv(1) == "$gameversion") {
-                       //versionmsg = "^1client is too old to get versioninfo.\nUPDATE!!! (http://www.xonotic.com)^8";
-                       // either that or someone wants to be funny
-                       self.version = 1;
-               } else {
-                       self.version = stof(argv(1));
-               }
-               if(self.version < autocvar_gameversion_min || self.version > autocvar_gameversion_max)
-               {
-                       self.version_mismatch = 1;
-                       ClientKill_TeamChange(-2); // observe
-               } else if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force) {
-                       //JoinBestTeam(self, FALSE, TRUE);
-               } else if(teamplay && !autocvar_sv_spectate && !(self.team_forced > 0)) {
-                       self.classname = "observer";
-                       stuffcmd(self,"menu_showteamselect\n");
-               }
-       } else if(cmd == "reportcvar") { // old system
-               if(substring(argv(2), 0, 1) == "$") // undefined cvar: use the default value on the server then
-               {
-                       s = strcat(substring(s, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
-                       tokens = tokenize_console(s);
-               }
-               GetCvars(1);
-       } else if(cmd == "sentcvar") { // new system
-               if(tokens == 2) // undefined cvar: use the default value on the server then
-               {
-                       s = strcat(substring(s, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
-                       tokens = tokenize_console(s);
-               }
-               GetCvars(1);
-       } else if(cmd == "spectate") {
-               if(cmd_floodcheck())
-                       return;
-               if not(self.flags & FL_CLIENT)
-                       return;
-               if(g_arena)
-                       return;
-               if(g_lms)
-               {
-                       if(self.lms_spectate_warning)
-                       {
-                               // mark player as spectator
-                               PlayerScore_Add(self, SP_LMS_RANK, 666 - PlayerScore_Add(self, SP_LMS_RANK, 0));
-                       }
-                       else
-                       {
-                               self.lms_spectate_warning = 1;
-                               sprint(self, "WARNING: you won't be able to enter the game again after spectating in LMS. Use the same command again to spectate anyway.\n");
-                               return;
-                       }
-               }
-               if(self.classname == "player" && autocvar_sv_spectate == 1) {
-                       ClientKill_TeamChange(-2); // observe
-               }
-       } else if(cmd == "join") {
-               if not(self.flags & FL_CLIENT)
-                       return;
-               if(!g_arena)
-               if (self.classname != "player" && !lockteams)
-               {
-                       if(nJoinAllowed(1)) {
-                               self.classname = "player";
-                               if(g_ca)
-                                       self.caplayer = 1;
-                               PlayerScore_Clear(self);
-                               bprint ("^4", self.netname, "^4 is playing now\n");
-                               PutClientInServer();
-                               if(autocvar_g_campaign)
-                                       campaign_bots_may_start = 1;
-                       }
-                       else {
-                               //player may not join because of g_maxplayers is set
-                               centerprint_atprio(self, CENTERPRIO_MAPVOTE, PREVENT_JOIN_TEXT);
-                       }
-               }
-       } else if( cmd == "selectteam" ) {
-               if not(self.flags & FL_CLIENT)
-                       return;
-               if( !teamplay ) {
-                       sprint( self, "selectteam can only be used in teamgames\n");
-               } else if(autocvar_g_campaign) {
-                       //JoinBestTeam(self, 0);
-               } else if(self.team_forced > 0) {
-                       sprint( self, "selectteam can not be used as your team is forced\n");
-               } else if(lockteams) {
-                       sprint( self, "^7The game has already begun, you must wait until the next map to be able to join a team.\n");
-               } else if( argv(1) == "red" ) {
-                       ClientKill_TeamChange(COLOR_TEAM1);
-               } else if( argv(1) == "blue" ) {
-                       ClientKill_TeamChange(COLOR_TEAM2);
-               } else if( argv(1) == "yellow" ) {
-                       ClientKill_TeamChange(COLOR_TEAM3);
-               } else if( argv(1) == "pink" ) {
-                       ClientKill_TeamChange(COLOR_TEAM4);
-               } else if( argv(1) == "auto" ) {
-                       ClientKill_TeamChange(-1);
-               } else {
-                       sprint( self, strcat( "selectteam none/red/blue/yellow/pink/auto - \"", argv(1), "\" not recognised\n" ) );
-               }
-       } else if(cmd == "ready") {
-               if not(self.flags & FL_CLIENT)
-                       return;
-
-               if((inWarmupStage)
-                  || autocvar_sv_ready_restart || g_race_qualifying == 2)
-               {
-                       if(!readyrestart_happened || autocvar_sv_ready_restart_repeatable)
-                       {
-                               if (self.ready) // toggle
-                               {
-                                       self.ready = FALSE;
-                                       bprint(self.netname, "^2 is ^1NOT^2 ready\n");
-                               }
-                               else
-                               {
-                                       self.ready = TRUE;
-                                       bprint(self.netname, "^2 is ready\n");
-                               }
-
-                               // cannot reset the game while a timeout is active!
-                               if(!timeoutStatus)
-                                       ReadyCount();
-                       } else {
-                               sprint(self, "^1Game has already been restarted\n");
-                       }
-               }
-       } else if(cmd == "maplist") {
-               sprint(self, maplist_reply);
-       } else if(cmd == "lsmaps") {
-               sprint(self, lsmaps_reply);
-       } else if(cmd == "lsnewmaps") {
-               sprint(self, lsnewmaps_reply);
-       } else if(cmd == "records") {
-               for(i = 0; i < 10; ++i)
-                       sprint(self, records_reply[i]);
-       } else if(cmd == "ladder") {
-               sprint(self, ladder_reply);
-       } else if(cmd == "rankings") {
-               sprint(self, rankings_reply);
-       } else if(cmd == "voice") {
-               if(tokens >= 3)
-                       VoiceMessage(argv(1), substring(s, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
-               else
-                       VoiceMessage(argv(1), "");
-       } else if(cmd == "say") {
-               if(tokens >= 2)
-                       Say(self, FALSE, world, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1);
-               //clientcommand(self, formatmessage(s));
-       } else if(cmd == "say_team") {
-               if(tokens >= 2)
-                       Say(self, TRUE, world, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1);
-               //clientcommand(self, formatmessage(s));
-       } else if(cmd == "tell") {
-               e = GetCommandPlayerSlotTargetFromTokenizedCommand(tokens, 1);
-               if(e && tokens > ParseCommandPlayerSlotTarget_firsttoken)
-               {
-                       Say(self, FALSE, e, substring(s, argv_start_index(ParseCommandPlayerSlotTarget_firsttoken), argv_end_index(-1) - argv_start_index(ParseCommandPlayerSlotTarget_firsttoken)), TRUE);
-               }
-               else
-               {
-                       if(tokens > ParseCommandPlayerSlotTarget_firsttoken)
-                               trigger_magicear_processmessage_forallears(self, -1, world, substring(s, argv_start_index(ParseCommandPlayerSlotTarget_firsttoken), argv_end_index(-1) - argv_start_index(ParseCommandPlayerSlotTarget_firsttoken)));
-                       sprint(self, "ERROR: usage: tell # playerid text...\n");
-               }
-               //clientcommand(self, formatmessage(s));
-       } else if(cmd == "info") {
-               cmd = cvar_string_builtin(strcat("sv_info_", argv(1))); // This needed fixed for the cvar check
-               if(cmd == "")
-                       sprint(self, "ERROR: unsupported info command\n");
-               else
-                       wordwrap_sprint(cmd, 1111);
-       } else if(cmd == "suggestmap") {
-               sprint(self, strcat(MapVote_Suggest(argv(1)), "\n"));
-       } else if(cmd == "timeout") {
-               if not(self.flags & FL_CLIENT)
-                       return;
-               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
-                                       evaluateTimeout();
-                       }
-                       else
-                               sprint(self, "^7Error: only players can call a timeout!\n");
-               }
-       } else if(cmd == "timein") {
-               if not(self.flags & FL_CLIENT)
-                       return;
-               if(autocvar_sv_timeout) {
-                       evaluateTimein();
-               }
-       } else if(cmd == "teamstatus") {
-               Score_NicePrint(self);
-       } else if(cmd == "cvar_changes") {
-               sprint(self, cvar_changes);
-       } else if(cmd == "cvar_purechanges") {
-               sprint(self, cvar_purechanges);
-       } else if(CheatCommand(tokens)) {
-       } else {
-#if 0
-               //if(ctf_clientcommand())
-               //      return;
-               // grep for Cmd_AddCommand_WithClientCommand to find them all
-               if(cmd != "status")
-               //if(cmd != "say") // handled above
-               //if(cmd != "say_team") // handled above
-               if(cmd != "kill")
-               if(cmd != "pause")
-               if(cmd != "ping")
-               if(cmd != "name")
-               if(cmd != "color")
-               if(cmd != "rate")
-               if(cmd != "pmodel")
-               if(cmd != "playermodel")
-               if(cmd != "playerskin")
-               if(cmd != "prespawn")
-               if(cmd != "spawn")
-               if(cmd != "begin")
-               if(cmd != "pings")
-               if(cmd != "sv_startdownload")
-               if(cmd != "download")
-               {
-                       print("WARNING: Invalid clientcommand by ", self.netname, ": ", s, "\n");
-                       return;
-               }
-#endif
-
-               if(self.jointime > 0 && time > self.jointime + 10 && time > self.nickspamtime) // allow any changes in the first 10 seconds since joining
-               if(cmd == "name" || cmd == "playermodel") // TODO also playerskin and color?
-               {
-                       if(self.nickspamtime == 0 || time > self.nickspamtime + autocvar_g_nick_flood_timeout)
-                               // good, no serious flood
-                               self.nickspamcount = 1;
-                       else
-                               self.nickspamcount += 1;
-                       self.nickspamtime = time + autocvar_g_nick_flood_penalty;
-
-                       if (timeoutStatus == 2) //when game is paused, no flood protection
-                               self.nickspamcount = self.nickspamtime = 0;
-               }
-
-               clientcommand(self,s);
-       }
-}
-
 void ReadyRestartForce()
 {
        local entity e;
@@ -554,83 +255,922 @@ void restartTimer_Think() {
        return;
 }
 
-/**
- * Checks whether the player who calls the timeout is allowed to do so.
- * If so, it initializes the timeout countdown. It also checks whether another
- * timeout was already running at this time and reacts correspondingly.
- *
- * affected globals/fields: .allowedTimeouts, remainingTimeoutTime, remainingLeadTime,
- *                          timeoutInitiator, timeoutStatus, timeoutHandler
- *
- * This function is called when a player issues the calltimeout command.
- */
-void evaluateTimeout() {
-       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
-                       local float myTl;
-                       myTl = autocvar_timelimit;
-
-                       local 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");
-               }
+
+// =======================
+//  Command Sub-Functions
+// =======================
+
+void ClientCommand_autoswitch(float request, float argc)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2autoswitch^7: Whether or not to switch automatically when getting a better weapon\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       self.autoswitch = ("0" != 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:
+                       sprint(self, "\nUsage:^3 cmd autoswitch selection\n");
+                       sprint(self, "  Where 'selection' is 1 or 0 for on or off.\n"); 
+                       return;
        }
-       //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;
+}
+
+void ClientCommand_checkfail(float request, string command) // used only by client side code
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2checkfail^7: Report if a client-side check failed\n");
+                       return;
+                       
+               case CC_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;
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_REQUEST_USAGE:
+                       sprint(self, "\nUsage:^3 cmd checkfail message\n");
+                       sprint(self, "  Where 'message' is the message reported by client about the fail.\n");
+                       return;
        }
-       timeoutHandler.nextthink = time; //always let the entity think asap
+}
 
-       //inform all connected clients about the timeout call
-       Announce("timeoutcalled");
+void ClientCommand_clientversion(float request, float argc) // used only by client side code
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2clientversion^7: Release version of the game\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       if(self.flags & FL_CLIENT)
+                       {
+                               self.version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
+                               
+                               if(self.version < autocvar_gameversion_min || self.version > autocvar_gameversion_max)
+                               {
+                                       self.version_mismatch = 1;
+                                       ClientKill_TeamChange(-2); // observe
+                               } 
+                               else if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force) 
+                               {
+                                       //JoinBestTeam(self, FALSE, TRUE);
+                               } 
+                               else if(teamplay && !autocvar_sv_spectate && !(self.team_forced > 0)) 
+                               {
+                                       self.classname = "observer"; // really?
+                                       stuffcmd(self, "menu_showteamselect\n");
+                               }
+                       }
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_REQUEST_USAGE:
+                       sprint(self, "\nUsage:^3 cmd clientversion version\n");
+                       sprint(self, "  Where 'version' is the game version reported by self.\n");
+                       return;
+       }
 }
 
-/**
- * Checks whether a player is allowed to resume the game. If he is allowed to do it,
- * and the lead time for the timeout is still active, this countdown just will be aborted (the
- * game will never be paused). Otherwise the remainingTimeoutTime will be set to the corresponding
- * value of the cvar sv_timeout_resumetime.
- *
- * This function is called when a player issues the resumegame command.
- */
-void evaluateTimein() {
-       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) {
-               //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");
+void ClientCommand_cvar_changes(float request)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2cvar_changes^7: Prints a list of all changed server cvars\n");
+                       return;
+                       
+               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_HELP:
+                       sprint(self, "  ^2cvar_purechanges^7: Prints a list of all changed gameplay cvars\n");
+                       return;
+                       
+               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_info(float request, float argc)
+{
+       string command;
+       
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2info^7: Request for unique server information set up by admin\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       command = cvar_string_builtin(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)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2join^7: Become a player in the game\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       if(self.flags & FL_CLIENT)
+                       {
+                               if(self.classname != "player" && !lockteams && !g_arena)
+                               {
+                                       if(nJoinAllowed(1)) 
+                                       {
+                                               if(g_ca) { self.caplayer = 1; }
+                                               if(autocvar_g_campaign) { campaign_bots_may_start = 1; }
+                                               
+                                               self.classname = "player";
+                                               PlayerScore_Clear(self);
+                                               bprint ("^4", self.netname, "^4 is playing now\n");
+                                               PutClientInServer();
+                                       }
+                                       else 
+                                       {
+                                               //player may not join because of g_maxplayers is set
+                                               centerprint(self, PREVENT_JOIN_TEXT);
+                                       }
+                               }
+                       }
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_REQUEST_USAGE:
+                       sprint(self, "\nUsage:^3 cmd join\n");
+                       sprint(self, "  No arguments required.\n");
+                       return;
+       }
+}
 
+void ClientCommand_ladder(float request)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2ladder^7: Get information about top players if supported\n");
+                       return;
+                       
+               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_HELP:
+                       sprint(self, "  ^2lsmaps^7: List maps which can be used with the current game mode\n");
+                       return;
+                       
+               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)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2lsnewmaps^7: List maps which TODO\n");
+                       return;
+                       
+               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_HELP:
+                       sprint(self, "  ^2maplist^7: Full server maplist reply\n");
+                       return;
+                       
+               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_HELP:
+                       sprint(self, "  ^2rankings^7: Print information about rankings\n");
+                       return;
+                       
+               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_HELP:
+                       sprint(self, "  ^2ready^7: Qualify as ready to end warmup stage (or restart server if allowed)\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       if(self.flags & FL_CLIENT)
+                       {
+                               if(inWarmupStage || autocvar_sv_ready_restart || g_race_qualifying == 2)
+                               {
+                                       if(!readyrestart_happened || autocvar_sv_ready_restart_repeatable)
+                                       {
+                                               if (self.ready) // toggle
+                                               {
+                                                       self.ready = FALSE;
+                                                       bprint(self.netname, "^2 is ^1NOT^2 ready\n");
+                                               }
+                                               else
+                                               {
+                                                       self.ready = TRUE;
+                                                       bprint(self.netname, "^2 is ready\n");
+                                               }
+
+                                               // cannot reset the game while a timeout is active!
+                                               if(!timeoutStatus)
+                                                       ReadyCount();
+                                       } else {
+                                               sprint(self, "^1Game has already been restarted\n");
+                                       }
+                               }
+                       }
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_REQUEST_USAGE:
+                       sprint(self, "\nUsage:^3 cmd ready\n");
+                       sprint(self, "  No arguments required.\n");
+                       return;
+       }
+}
+
+void ClientCommand_records(float request) // TODO: Isn't this flooding with the sprint messages? Old code, but perhaps bad?
+{
+       float i;
+       
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2records^7: List top 10 records for the current map\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       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
+{
+       float tokens;
+       string s;
+       
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2reportcvar^7: Old system for sending a client cvar to the server\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       if(substring(argv(2), 0, 1) == "$") // undefined cvar: use the default value on the server then
+                       {
+                               s = strcat(substring(command, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
+                               tokens = tokenize_console(s);
+                       }
+                       GetCvars(1);
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_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");
+                       return;
+       }
+}
+
+void ClientCommand_say(float request, float argc, string command)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2say^7: Print a message to chat to all players\n");
+                       return;
+                       
+               case CC_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:
+                       sprint(self, "\nUsage:^3 cmd say <message>\n");
+                       sprint(self, "  Where 'message' is the string of text to say.\n");
+                       return;
+       }
+}
+
+void ClientCommand_say_team(float request, float argc, string command)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2say_team^7: Print a message to chat to all team mates\n");
+                       return;
+                       
+               case CC_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:
+                       sprint(self, "\nUsage:^3 cmd say_team <message>\n");
+                       sprint(self, "  Where 'message' is the string of text to say.\n");
+                       return;
+       }
+}
+
+void ClientCommand_selectteam(float request, float argc) // TODO: Update the messages for this command
+{
+       float selection;
+       
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2selectteam^7: Attempt to choose a team to join into\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       if (self.flags & FL_CLIENT)
+                       {
+                               if(teamplay)
+                                       if not(self.team_forced > 0) 
+                                               if not(lockteams) 
+                                               {
+                                                       switch(argv(1))
+                                                       {
+                                                               case "red": selection = COLOR_TEAM1; break;
+                                                               case "blue": selection = COLOR_TEAM2; break;
+                                                               case "yellow": selection = COLOR_TEAM3; break;
+                                                               case "pink": selection = COLOR_TEAM4; break;
+                                                               case "auto": selection = (-1); break;
+                                                               
+                                                               default: break;
+                                                       }
+                                                       
+                                                       if(selection)
+                                                       {
+                                                               if(self.team != selection || self.deadflag != DEAD_NO)
+                                                                       ClientKill_TeamChange(selection);
+                                                               else
+                                                                       sprint(self, "^7You already are on that team.\n");
+                                                       }
+                                               }
+                                               else
+                                                       sprint(self, "^7The game has already begun, you must wait until the next map to be able to join a team.\n");
+                                       else
+                                               sprint(self, "^7selectteam can not be used as your team is forced\n");
+                               else
+                                       sprint(self, "^7selectteam can only be used in teamgames\n");
+                       }
+                       return; // never fall through to usage
+
+               default:
+               case CC_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");
+                       sprint(self, "  Where 'team' is the prefered team to try and join.\n");
+                       sprint(self, "  Full list of options here: \"red, blue, yellow, pink, auto\"\n");
+                       return;
+       }
+}
+
+void ClientCommand_sentcvar(float request, float argc, string command)
+{
+       float tokens;
+       string s;
+       
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2sentcvar^7: New system for sending a client cvar to the server\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       if(argc == 2) // undefined cvar: use the default value on the server then
+                       {
+                               s = strcat(substring(command, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
+                               tokens = tokenize_console(s);
+                       }
+                       GetCvars(1);
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_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");
+                       return;
+       }
+}
+
+void ClientCommand_spectate(float request)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2spectate^7: Become an observer\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       if(self.flags & FL_CLIENT)
+                       {
+                               if(g_arena) { return; } 
+                               if(g_lms)
+                               {
+                                       if(self.lms_spectate_warning)
+                                       {
+                                               // mark player as spectator
+                                               PlayerScore_Add(self, SP_LMS_RANK, 666 - PlayerScore_Add(self, SP_LMS_RANK, 0));
+                                       }
+                                       else
+                                       {
+                                               self.lms_spectate_warning = 1;
+                                               sprint(self, "WARNING: you won't be able to enter the game again after spectating in LMS. Use the same command again to spectate anyway.\n");
+                                               return;
+                                       }
+                               }
+                               
+                               if(self.classname == "player" && autocvar_sv_spectate == 1) 
+                                       ClientKill_TeamChange(-2); // observe
+                               
+                               // in CA, allow a dead player to move to spectatators (without that, caplayer!=0 will be moved back to the player list)
+                               // note: if arena game mode is ever done properly, this needs to be removed.
+                               if(g_ca && self.caplayer && (self.classname == "spectator" || self.classname == "observer"))
+                               {
+                                       sprint(self, "WARNING: you will spectate in the next round.\n");
+                                       self.caplayer = 0;
+                               }
+                       }
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_REQUEST_USAGE:
+                       sprint(self, "\nUsage:^3 cmd spectate\n");
+                       sprint(self, "  No arguments required.\n");
+                       return;
+       }
+}
+
+void ClientCommand_suggestmap(float request, float argc)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2suggestmap^7: Suggest a map to the mapvote at match end\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       sprint(self, strcat(MapVote_Suggest(argv(1)), "\n"));
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_REQUEST_USAGE:
+                       sprint(self, "\nUsage:^3 cmd suggestmap map\n");
+                       sprint(self, "  Where 'map' is the name of the map to suggest.\n");
+                       return;
+       }
+}
+
+void ClientCommand_teamstatus(float request)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2teamstatus^7: Print detailed score information for all players\n");
+                       return;
+                       
+               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)
+{
+       entity e;
+       
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2tell^7: Send a message directly to a player\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       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_HELP:
+                       sprint(self, "  ^2timein^7: Resume the game from being paused with a timeout\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       if(self.flags & FL_CLIENT)
+                       {
+                               if(autocvar_sv_timeout)
+                               {
+                                       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) 
+                                       {
+                                               //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");
+                                       }
+                               }
+                       }
+                       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_HELP:
+                       sprint(self, "  ^2timeout^7: Call a timeout which pauses the game for certain amount of time unless unpaused\n");
+                       return;
+                       
+               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");
+                               }
+                       }
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_REQUEST_USAGE:
+                       sprint(self, "\nUsage:^3 cmd timeout\n");
+                       sprint(self, "  No arguments required.\n");
+                       return;
+       }
+}
+
+void ClientCommand_voice(float request, float argc, string command)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2voice^7: Send voice message via sound\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       if(argc >= 3)
+                               VoiceMessage(argv(1), substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
+                       else
+                               VoiceMessage(argv(1), "");
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_REQUEST_USAGE:
+                       sprint(self, "\nUsage:^3 cmd voice\n");
+                       sprint(self, "  FIXME ARGUMENTS UNKNOWN.\n");
+                       return;
+       }
+}
+
+/*
+void ClientCommand_(float request)
+{
+       switch(request)
+       {
+               case CC_REQUEST_HELP:
+                       sprint(self, "  ^2blah^7: foobar\n");
+                       return;
+                       
+               case CC_REQUEST_COMMAND:
+                       
+                       return; // never fall through to usage
+                       
+               default:
+               case CC_REQUEST_USAGE:
+                       sprint(self, "\nUsage:^3 cmd \n");
+                       sprint(self, "  No arguments required.\n");
+                       return;
+       }
+}
+*/
+
+
+// ======================================
+//  Main Function Called By Engine (cmd)
+// ======================================
+// If this function exists, server game code parses clientcommand before the engine code gets it.
+
+void SV_ParseClientCommand(string command)
+{
+       float search_request_type;
+       float argc = tokenize_console(command);
+       
+       // 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 "pause": break; // handled by engine in host_cmd.c
+               case "prespawn": break; // handled by engine in host_cmd.c
+               case "reportcvar": break; // handled by server in this file
+               case "sentcvar": break; // handled by server in this file
+               case "spawn": break; // handled by engine in host_cmd.c
+               
+               default: 
+                       if(SV_ParseClientCommand_floodcheck())
+                               break; // "TRUE": continue, as we're not flooding yet
+                       else
+                               return; // "FALSE": not allowed to continue, halt
+       }
+       
+       /* NOTE: totally disabled for now, however the functionality and descriptions are there if we ever want it.
+       if(argv(0) == "help") 
+       {
+               if(argc == 1) 
+               {
+                       sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are:\n");
+                       ClientCommand_autoswitch(CC_REQUEST_HELP, 0);
+                       ClientCommand_checkfail(CC_REQUEST_HELP, "");
+                       ClientCommand_clientversion(CC_REQUEST_HELP, 0);
+                       ClientCommand_cvar_changes(CC_REQUEST_HELP);
+                       ClientCommand_cvar_purechanges(CC_REQUEST_HELP);
+                       ClientCommand_info(CC_REQUEST_HELP, 0);
+                       ClientCommand_join(CC_REQUEST_HELP); 
+                       ClientCommand_ladder(CC_REQUEST_HELP);
+                       ClientCommand_lsmaps(CC_REQUEST_HELP);
+                       ClientCommand_lsnewmaps(CC_REQUEST_HELP);
+                       ClientCommand_maplist(CC_REQUEST_HELP);
+                       ClientCommand_rankings(CC_REQUEST_HELP);
+                       ClientCommand_ready(CC_REQUEST_HELP);
+                       ClientCommand_records(CC_REQUEST_HELP);
+                       ClientCommand_reportcvar(CC_REQUEST_HELP, 0, "");
+                       ClientCommand_say(CC_REQUEST_HELP, 0, "");
+                       ClientCommand_say_team(CC_REQUEST_HELP, 0, "");
+                       ClientCommand_selectteam(CC_REQUEST_HELP, 0);
+                       ClientCommand_sentcvar(CC_REQUEST_HELP, 0, "");
+                       ClientCommand_spectate(CC_REQUEST_HELP);
+                       ClientCommand_suggestmap(CC_REQUEST_HELP, 0);
+                       ClientCommand_teamstatus(CC_REQUEST_HELP);
+                       ClientCommand_tell(CC_REQUEST_HELP, 0, "");
+                       ClientCommand_timein(CC_REQUEST_HELP);
+                       ClientCommand_timeout(CC_REQUEST_HELP);
+                       ClientCommand_voice(CC_REQUEST_HELP, 0, "");
+                       sprint(self, "For help about specific commands, type cmd help COMMAND\n");
+                       return;
+               } 
+               else
+                       search_request_type = CC_REQUEST_USAGE; // Instead of trying to call a command, we're going to see detailed information about it
+       } 
+       else*/ if(GameCommand_Vote(command, self)) 
+       {
+               return; // handled by server/vote.qc 
+       }
+       else if(GameCommand_MapVote(argv(0))) 
+       {
+               return; // handled by server/g_world.qc
+       }
+       else if(CheatCommand(argc)) 
+       {
+               return; // handled by server/cheats.qc
+       }
+       else
+               search_request_type = CC_REQUEST_COMMAND; // continue as usual and scan for normal commands
+       
+       switch(strtolower((search_request_type == CC_REQUEST_USAGE) ? argv(1) : argv(0)))
+       {
+               // Do not hard code aliases for these, instead create them in defaultXonotic.cfg
+               // also: keep in alphabetical order, please ;)
+               
+               case "autoswitch": ClientCommand_autoswitch(search_request_type, argc); break;
+               case "checkfail": ClientCommand_checkfail(search_request_type, command); break;
+               case "clientversion": ClientCommand_clientversion(search_request_type, argc); break;
+               case "cvar_changes": ClientCommand_cvar_changes(search_request_type); break;
+               case "cvar_purechanges": ClientCommand_cvar_purechanges(search_request_type); break;
+               case "info": ClientCommand_info(search_request_type, argc); break;
+               case "join": ClientCommand_join(search_request_type); break;
+               case "ladder": ClientCommand_ladder(search_request_type); break;
+               case "lsmaps": ClientCommand_lsmaps(search_request_type); break;
+               case "lsnewmaps": ClientCommand_lsnewmaps(search_request_type); break;
+               case "maplist": ClientCommand_maplist(search_request_type); break;
+               case "rankings": ClientCommand_rankings(search_request_type); break;
+               case "ready": ClientCommand_ready(search_request_type); break;
+               case "records": ClientCommand_records(search_request_type); break;
+               case "reportcvar": ClientCommand_reportcvar(search_request_type, argc, command); break;
+               case "say": ClientCommand_say(search_request_type, argc, command); break;
+               case "say_team": ClientCommand_say_team(search_request_type, argc, command); break;
+               case "selectteam": ClientCommand_selectteam(search_request_type, argc); break;
+               case "sentcvar": ClientCommand_sentcvar(search_request_type, argc, command); break;
+               case "spectate": ClientCommand_spectate(search_request_type); break;
+               case "suggestmap": ClientCommand_suggestmap(search_request_type, argc); break;
+               case "teamstatus": ClientCommand_teamstatus(search_request_type); break;
+               case "tell": ClientCommand_tell(search_request_type, argc, command); break;
+               case "timein": ClientCommand_timein(search_request_type); break;
+               case "timeout": ClientCommand_timeout(search_request_type); break;
+               case "voice": ClientCommand_voice(search_request_type, argc, command); break;
+               
+               default:
+                       clientcommand(self, command); //print("Invalid command. For a list of supported commands, try cmd help.\n");
+       }
+}
\ No newline at end of file