]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/command/cmd.qc
Working on tell command
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / cmd.qc
1 // =========================================================
2 //  Server side networked commands code, reworked by Samual
3 //  Last updated: December 13th, 2011
4 // =========================================================
5
6 float SV_ParseClientCommand_floodcheck()
7 {
8         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)
9         {
10                 if(time <= (self.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
11                 {
12                         self.cmd_floodcount += 1;
13                         if(self.cmd_floodcount > autocvar_sv_clientcommand_antispam_count) { return FALSE; } // too much spam, halt
14                 }
15                 else
16                 {
17                         self.cmd_floodtime = time;
18                         self.cmd_floodcount = 1;
19                 }
20         }
21         return TRUE; // continue, as we're not flooding yet
22 }
23
24
25 // =======================
26 //  Command Sub-Functions
27 // =======================
28
29 void ClientCommand_autoswitch(float request, float argc)
30 {
31         switch(request)
32         {
33                 case CMD_REQUEST_COMMAND:
34                 {
35                         self.autoswitch = InterpretBoolean(argv(1));
36                         sprint(self, strcat("^1autoswitch is currently turned ", (self.autoswitch ? "on" : "off"), ".\n"));
37                         return; // never fall through to usage
38                 }
39                         
40                 default:
41                 case CMD_REQUEST_USAGE:
42                 {
43                         sprint(self, "\nUsage:^3 cmd autoswitch selection\n");
44                         sprint(self, "  Where 'selection' controls if autoswitch is on or off.\n"); 
45                         return;
46                 }
47         }
48 }
49
50 void ClientCommand_checkfail(float request, string command) // used only by client side code
51 {
52         switch(request)
53         {
54                 case CMD_REQUEST_COMMAND:
55                 {
56                         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))));
57                         self.checkfail = 1;
58                         return; // never fall through to usage
59                 }
60                         
61                 default:
62                 case CMD_REQUEST_USAGE:
63                 {
64                         sprint(self, "\nUsage:^3 cmd checkfail message\n");
65                         sprint(self, "  Where 'message' is the message reported by client about the fail.\n");
66                         return;
67                 }
68         }
69 }
70
71 void ClientCommand_clientversion(float request, float argc) // used only by client side code
72 {
73         switch(request)
74         {
75                 case CMD_REQUEST_COMMAND:
76                 {
77                         if(self.flags & FL_CLIENT)
78                         {
79                                 self.version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
80                                 
81                                 if(self.version < autocvar_gameversion_min || self.version > autocvar_gameversion_max)
82                                 {
83                                         self.version_mismatch = 1;
84                                         ClientKill_TeamChange(-2); // observe
85                                 } 
86                                 else if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force) 
87                                 {
88                                         //JoinBestTeam(self, FALSE, TRUE);
89                                 } 
90                                 else if(teamplay && !autocvar_sv_spectate && !(self.team_forced > 0)) 
91                                 {
92                                         self.classname = "observer"; // really?
93                                         stuffcmd(self, "menu_showteamselect\n");
94                                 }
95                         }
96                         return; // never fall through to usage
97                 }
98                         
99                 default:
100                 case CMD_REQUEST_USAGE:
101                 {
102                         sprint(self, "\nUsage:^3 cmd clientversion version\n");
103                         sprint(self, "  Where 'version' is the game version reported by self.\n");
104                         return;
105                 }
106         }
107 }
108
109 void ClientCommand_getmapvotepic(float request, float argc)
110 {
111         switch(request)
112         {
113                 case CMD_REQUEST_COMMAND:
114                 {
115                         if(intermission_running)                                
116                                 MapVote_SendPicture(stof(argv(1)));
117
118                         return; // never fall through to usage
119                 }
120                         
121                 default:
122                 case CMD_REQUEST_USAGE:
123                 {
124                         sprint(self, "\nUsage:^3 cmd getmapvotepic mapid\n");
125                         sprint(self, "  Where 'mapid' is the id number of the map to request an image of on the map vote selection menu.\n");
126                         return;
127                 }
128         }
129 }
130
131 void ClientCommand_join(float request)
132 {
133         switch(request)
134         {
135                 case CMD_REQUEST_COMMAND:
136                 {
137                         if(self.flags & FL_CLIENT)
138                         {
139                                 if(self.classname != "player" && !lockteams && !g_arena)
140                                 {
141                                         if(nJoinAllowed(1)) 
142                                         {
143                                                 if(g_ca) { self.caplayer = 1; }
144                                                 if(autocvar_g_campaign) { campaign_bots_may_start = 1; }
145                                                 
146                                                 self.classname = "player";
147                                                 PlayerScore_Clear(self);
148                                                 bprint ("^4", self.netname, "^4 is playing now\n");
149                                                 PutClientInServer();
150                                         }
151                                         else 
152                                         {
153                                                 //player may not join because of g_maxplayers is set
154                                                 centerprint(self, PREVENT_JOIN_TEXT);
155                                         }
156                                 }
157                         }
158                         return; // never fall through to usage
159                 }
160                         
161                 default:
162                 case CMD_REQUEST_USAGE:
163                 {
164                         sprint(self, "\nUsage:^3 cmd join\n");
165                         sprint(self, "  No arguments required.\n");
166                         return;
167                 }
168         }
169 }
170
171 void ClientCommand_ready(float request) 
172 {
173         switch(request)
174         {
175                 case CMD_REQUEST_COMMAND:
176                 {
177                         if(self.flags & FL_CLIENT)
178                         {
179                                 if(inWarmupStage || autocvar_sv_ready_restart || g_race_qualifying == 2)
180                                 {
181                                         if(!readyrestart_happened || autocvar_sv_ready_restart_repeatable)
182                                         {
183                                                 if (self.ready) // toggle
184                                                 {
185                                                         self.ready = FALSE;
186                                                         bprint(self.netname, "^2 is ^1NOT^2 ready\n");
187                                                 }
188                                                 else
189                                                 {
190                                                         self.ready = TRUE;
191                                                         bprint(self.netname, "^2 is ready\n");
192                                                 }
193
194                                                 // cannot reset the game while a timeout is active!
195                                                 if(!timeoutStatus)
196                                                         ReadyCount();
197                                         } else {
198                                                 sprint(self, "^1Game has already been restarted\n");
199                                         }
200                                 }
201                         }
202                         return; // never fall through to usage
203                 }
204                         
205                 default:
206                 case CMD_REQUEST_USAGE:
207                 {
208                         sprint(self, "\nUsage:^3 cmd ready\n");
209                         sprint(self, "  No arguments required.\n");
210                         return;
211                 }
212         }
213 }
214
215 void ClientCommand_reportcvar(float request, float argc, string command) // TODO: confirm this works
216 {       
217         switch(request)
218         {
219                 case CMD_REQUEST_COMMAND:
220                 {
221                         float tokens;
222                         string s;
223                         
224                         if(substring(argv(2), 0, 1) == "$") // undefined cvar: use the default value on the server then
225                         {
226                                 s = strcat(substring(command, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
227                                 tokens = tokenize_console(s);
228                         }
229                         GetCvars(1);
230                         return; // never fall through to usage
231                 }
232                         
233                 default:
234                 case CMD_REQUEST_USAGE:
235                 {
236                         sprint(self, "\nUsage:^3 cmd reportcvar <cvar>\n");
237                         sprint(self, "  Where 'cvar' is the cvar plus arguments to send to the server.\n");
238                         return;
239                 }
240         }
241 }
242
243 void ClientCommand_say(float request, float argc, string command)
244 {
245         switch(request)
246         {
247                 case CMD_REQUEST_COMMAND:
248                 {
249                         if(argc >= 2) { Say(self, FALSE, world, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); }
250                         return; // never fall through to usage
251                 }
252                         
253                 default:
254                 case CMD_REQUEST_USAGE:
255                 {
256                         sprint(self, "\nUsage:^3 cmd say <message>\n");
257                         sprint(self, "  Where 'message' is the string of text to say.\n");
258                         return;
259                 }
260         }
261 }
262
263 void ClientCommand_say_team(float request, float argc, string command)
264 {
265         switch(request)
266         {
267                 case CMD_REQUEST_COMMAND:
268                 {
269                         if(argc >= 2) { Say(self, TRUE, world, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1); }
270                         return; // never fall through to usage
271                 }
272                         
273                 default:
274                 case CMD_REQUEST_USAGE:
275                 {
276                         sprint(self, "\nUsage:^3 cmd say_team <message>\n");
277                         sprint(self, "  Where 'message' is the string of text to say.\n");
278                         return;
279                 }
280         }
281 }
282
283 void ClientCommand_selectteam(float request, float argc) // TODO: Update the messages for this command
284 {
285         switch(request)
286         {
287                 case CMD_REQUEST_COMMAND:
288                 {
289                         float selection;
290                         
291                         if (self.flags & FL_CLIENT)
292                         {
293                                 if(teamplay)
294                                         if not(self.team_forced > 0) 
295                                                 if not(lockteams) 
296                                                 {
297                                                         switch(argv(1))
298                                                         {
299                                                                 case "red": selection = COLOR_TEAM1; break;
300                                                                 case "blue": selection = COLOR_TEAM2; break;
301                                                                 case "yellow": selection = COLOR_TEAM3; break;
302                                                                 case "pink": selection = COLOR_TEAM4; break;
303                                                                 case "auto": selection = (-1); break;
304                                                                 
305                                                                 default: break;
306                                                         }
307                                                         
308                                                         if(selection)
309                                                         {
310                                                                 if(self.team == selection && self.deadflag == DEAD_NO)
311                                                                         sprint(self, "^7You already are on that team.\n");
312                                                                 else if(self.wasplayer && autocvar_g_changeteam_banned)
313                                                                         sprint(self, "^1You cannot change team, forbidden by the server.\n");
314                                                                 else
315                                                                         ClientKill_TeamChange(selection);
316                                                         }
317                                                 }
318                                                 else
319                                                         sprint(self, "^7The game has already begun, you must wait until the next map to be able to join a team.\n");
320                                         else
321                                                 sprint(self, "^7selectteam can not be used as your team is forced\n");
322                                 else
323                                         sprint(self, "^7selectteam can only be used in teamgames\n");
324                         }
325                         return; // never fall through to usage
326                 }
327
328                 default:
329                 case CMD_REQUEST_USAGE:
330                 {
331                         //sprint(self, strcat( "selectteam none/red/blue/yellow/pink/auto - \"", argv(1), "\" not recognised\n" ) );
332                         sprint(self, "\nUsage:^3 cmd selectteam team\n");
333                         sprint(self, "  Where 'team' is the prefered team to try and join.\n");
334                         sprint(self, "  Full list of options here: \"red, blue, yellow, pink, auto\"\n");
335                         return;
336                 }
337         }
338 }
339
340 void ClientCommand_selfstuff(float request, string command)
341 {
342         switch(request)
343         {
344                 case CMD_REQUEST_COMMAND:
345                 {
346                         stuffcmd(self, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
347                         return; // never fall through to usage
348                 }
349                         
350                 default:
351                 case CMD_REQUEST_USAGE:
352                 {
353                         sprint(self, "\nUsage:^3 cmd selfstuff command\n");
354                         sprint(self, "  Where 'command' is the string to be stuffed to your client.\n");
355                         return;
356                 }
357         }
358 }
359
360 void ClientCommand_sentcvar(float request, float argc, string command)
361 {
362         switch(request)
363         {
364                 case CMD_REQUEST_COMMAND:
365                 {
366                         float tokens;
367                         string s;
368                         
369                         if(argc == 2) // undefined cvar: use the default value on the server then
370                         {
371                                 s = strcat(substring(command, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
372                                 tokens = tokenize_console(s);
373                         }
374                         GetCvars(1);
375                         return; // never fall through to usage
376                 }
377                         
378                 default:
379                 case CMD_REQUEST_USAGE:
380                 {
381                         sprint(self, "\nUsage:^3 cmd sentcvar <cvar>\n");
382                         sprint(self, "  Where 'cvar' is the cvar plus arguments to send to the server.\n");
383                         return;
384                 }
385         }
386 }
387
388 void ClientCommand_spectate(float request)
389 {
390         switch(request)
391         {
392                 case CMD_REQUEST_COMMAND:
393                 {
394                         if(self.flags & FL_CLIENT)
395                         {
396                                 if(g_arena) { return; } 
397                                 if(g_lms)
398                                 {
399                                         if(self.lms_spectate_warning)
400                                         {
401                                                 // mark player as spectator
402                                                 PlayerScore_Add(self, SP_LMS_RANK, 666 - PlayerScore_Add(self, SP_LMS_RANK, 0));
403                                         }
404                                         else
405                                         {
406                                                 self.lms_spectate_warning = 1;
407                                                 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");
408                                                 return;
409                                         }
410                                 }
411                                 
412                                 if(self.classname == "player" && autocvar_sv_spectate == 1) 
413                                         ClientKill_TeamChange(-2); // observe
414                                 
415                                 // in CA, allow a dead player to move to spectatators (without that, caplayer!=0 will be moved back to the player list)
416                                 // note: if arena game mode is ever done properly, this needs to be removed.
417                                 if(g_ca && self.caplayer && (self.classname == "spectator" || self.classname == "observer"))
418                                 {
419                                         sprint(self, "WARNING: you will spectate in the next round.\n");
420                                         self.caplayer = 0;
421                                 }
422                         }
423                         return; // never fall through to usage
424                 }
425                         
426                 default:
427                 case CMD_REQUEST_USAGE:
428                 {
429                         sprint(self, "\nUsage:^3 cmd spectate\n");
430                         sprint(self, "  No arguments required.\n");
431                         return;
432                 }
433         }
434 }
435
436 void ClientCommand_suggestmap(float request, float argc)
437 {
438         switch(request)
439         {
440                 case CMD_REQUEST_COMMAND:
441                 {
442                         sprint(self, strcat(MapVote_Suggest(argv(1)), "\n"));
443                         return; // never fall through to usage
444                 }
445                         
446                 default:
447                 case CMD_REQUEST_USAGE:
448                 {
449                         sprint(self, "\nUsage:^3 cmd suggestmap map\n");
450                         sprint(self, "  Where 'map' is the name of the map to suggest.\n");
451                         return;
452                 }
453         }
454 }
455
456 void ClientCommand_tell(float request, float argc, string command)
457 {
458         switch(request)
459         {
460                 case CMD_REQUEST_COMMAND:
461                 {
462                         if(argc >= 3)
463                         {
464                                 if(strtolower(argv(1)) != "world")
465                                 {
466                                         entity to = GetFilteredEntity(argv(1));
467                                         float accepted = VerifyClientEntity(to, TRUE, FALSE);
468                                         
469                                         print("accepted: ", ftos(accepted), ".\n");
470                                         
471                                         if(accepted)
472                                         {
473                                                 Say(self, FALSE, to, substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)), TRUE);
474                                                 return;
475                                         }
476                                         else { print_to(self, GetClientErrorString(accepted, argv(1))); }
477                                 }
478                                 else
479                                 {
480                                         trigger_magicear_processmessage_forallears(self, -1, world, substring(command, argv_start_index(ParseCommandPlayerSlotTarget_firsttoken), argv_end_index(-1) - argv_start_index(ParseCommandPlayerSlotTarget_firsttoken)));
481                                         return;
482                                 }
483                         }
484                 }
485                         
486                 default:
487                         sprint(self, "Incorrect parameters for ^2tell^7\n");
488                 case CMD_REQUEST_USAGE:
489                 {
490                         sprint(self, "\nUsage:^3 cmd tell client <message>\n");
491                         sprint(self, "  Where 'client' is the entity number or name of the player to send 'message' to.\n");
492                         return;
493                 }
494         }
495 }
496
497 void ClientCommand_voice(float request, float argc, string command)
498 {
499         switch(request)
500         {
501                 case CMD_REQUEST_COMMAND:
502                 {
503                         if(argc >= 3)
504                                 VoiceMessage(argv(1), substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
505                         else
506                                 VoiceMessage(argv(1), "");
507                         return; // never fall through to usage
508                 }
509                         
510                 default:
511                 case CMD_REQUEST_USAGE:
512                 {
513                         sprint(self, "\nUsage:^3 cmd voice\n");
514                         sprint(self, "  FIXME ARGUMENTS UNKNOWN.\n");
515                         return;
516                 }
517         }
518 }
519
520 /* use this when creating a new command, making sure to place it in alphabetical order.
521 void ClientCommand_(float request)
522 {
523         switch(request)
524         {
525                 case CMD_REQUEST_COMMAND:
526                 {
527                         
528                         return; // never fall through to usage
529                 }
530                         
531                 default:
532                 case CMD_REQUEST_USAGE:
533                 {
534                         sprint(self, "\nUsage:^3 cmd \n");
535                         sprint(self, "  No arguments required.\n");
536                         return;
537                 }
538         }
539 }
540 */
541
542
543 // =====================================
544 //  Macro system for networked commands
545 // =====================================
546
547 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
548 #define CLIENT_COMMANDS(request,arguments,command) \
549         CLIENT_COMMAND("autoswitch", ClientCommand_autoswitch(request, arguments), "Whether or not to switch automatically when getting a better weapon") \
550         CLIENT_COMMAND("checkfail", ClientCommand_checkfail(request, command), "Report if a client-side check failed") \
551         CLIENT_COMMAND("clientversion", ClientCommand_clientversion(request, arguments), "Release version of the game") \
552         CLIENT_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, self), "Prints a list of all changed server cvars") \
553         CLIENT_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, self), "Prints a list of all changed gameplay cvars") \
554         CLIENT_COMMAND("getmapvotepic", ClientCommand_getmapvotepic(request, arguments), "Retrieve mapshot picture from the server") \
555         CLIENT_COMMAND("info", CommonCommand_info(request, self, arguments), "Request for unique server information set up by admin") \
556         CLIENT_COMMAND("join", ClientCommand_join(request), "Become a player in the game") \
557         CLIENT_COMMAND("ladder", CommonCommand_ladder(request, self), "Get information about top players if supported") \
558         CLIENT_COMMAND("lsmaps", CommonCommand_lsmaps(request, self), "List maps which can be used with the current game mode") \
559         CLIENT_COMMAND("lsnewmaps", CommonCommand_lsnewmaps(request, self), "List maps which TODO") \
560         CLIENT_COMMAND("maplist", CommonCommand_maplist(request, self), "Display full server maplist reply") \
561         CLIENT_COMMAND("rankings", CommonCommand_rankings(request, self), "Print information about rankings") \
562         CLIENT_COMMAND("ready", ClientCommand_ready(request), "Qualify as ready to end warmup stage (or restart server if allowed)") \
563         CLIENT_COMMAND("records", CommonCommand_records(request, self), "List top 10 records for the current map") \
564         CLIENT_COMMAND("reportcvar", ClientCommand_reportcvar(request, arguments, command), "Old system for sending a client cvar to the server") \
565         CLIENT_COMMAND("say", ClientCommand_say(request, arguments, command), "Print a message to chat to all players") \
566         CLIENT_COMMAND("say_team", ClientCommand_say_team(request, arguments, command), "Print a message to chat to all team mates") \
567         CLIENT_COMMAND("selectteam", ClientCommand_selectteam(request, arguments), "Attempt to choose a team to join into") \
568         CLIENT_COMMAND("selfstuff", ClientCommand_selfstuff(request, command), "Stuffcmd a command to your own client") \
569         CLIENT_COMMAND("sentcvar", ClientCommand_sentcvar(request, arguments, command), "New system for sending a client cvar to the server") \
570         CLIENT_COMMAND("spectate", ClientCommand_spectate(request), "Become an observer") \
571         CLIENT_COMMAND("suggestmap", ClientCommand_suggestmap(request, arguments), "Suggest a map to the mapvote at match end") \
572         CLIENT_COMMAND("teamstatus", CommonCommand_teamstatus(request, self), "Show information about player and team scores") \
573         CLIENT_COMMAND("tell", ClientCommand_tell(request, arguments, command), "Send a message directly to a player") \
574         CLIENT_COMMAND("time", CommonCommand_time(request, self), "Print different formats/readouts of time") \
575         CLIENT_COMMAND("timein", CommonCommand_timein(request, self), "Resume the game from being paused with a timeout") \
576         CLIENT_COMMAND("timeout", CommonCommand_timeout(request, self), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
577         CLIENT_COMMAND("voice", ClientCommand_voice(request, arguments, command), "Send voice message via sound") \
578         CLIENT_COMMAND("vote", VoteCommand(request, self, arguments, command), "Request an action to be voted upon by players") \
579         CLIENT_COMMAND("who", CommonCommand_who(request, self, arguments), "Display detailed client information about all players") \
580         /* nothing */
581         
582 void ClientCommand_macro_help()
583 {
584         #define CLIENT_COMMAND(name,function,description) \
585                 { print("  ^2", name, "^7: ", description, "\n"); }
586                 
587         CLIENT_COMMANDS(0, 0, "")
588         #undef CLIENT_COMMAND
589         
590         return;
591 }
592
593 float ClientCommand_macro_command(float argc, string command)
594 {
595         #define CLIENT_COMMAND(name,function,description) \
596                 { if(name == strtolower(argv(0))) { function; return TRUE; } }
597                 
598         CLIENT_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
599         #undef CLIENT_COMMAND
600         
601         return FALSE;
602 }
603
604 float ClientCommand_macro_usage(float argc, string command)
605 {
606         #define CLIENT_COMMAND(name,function,description) \
607                 { if(name == strtolower(argv(1))) { function; return TRUE; } }
608                 
609         CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc, command)
610         #undef CLIENT_COMMAND
611         
612         return FALSE;
613 }
614
615
616 // ======================================
617 //  Main Function Called By Engine (cmd)
618 // ======================================
619 // If this function exists, server game code parses clientcommand before the engine code gets it.
620
621 void SV_ParseClientCommand(string command)
622 {
623         float argc = tokenize_console(command);
624         
625         // Guide for working with argc arguments by example:
626         // argc:   1    - 2      - 3     - 4
627         // argv:   0    - 1      - 2     - 3 
628         // cmd     vote - master - login - password
629         
630         // for floodcheck
631         switch(strtolower(argv(0)))
632         {
633                 // exempt commands which are not subject to floodcheck
634                 case "begin": break; // handled by engine in host_cmd.c
635                 case "download": break; // handled by engine in cl_parse.c
636                 case "getmapvotepic": break; // handled by server in this file
637                 case "pause": break; // handled by engine in host_cmd.c
638                 case "prespawn": break; // handled by engine in host_cmd.c
639                 case "reportcvar": break; // handled by server in this file
640                 case "sentcvar": break; // handled by server in this file
641                 case "spawn": break; // handled by engine in host_cmd.c
642                 
643                 default: 
644                         if(SV_ParseClientCommand_floodcheck())
645                                 break; // "TRUE": continue, as we're not flooding yet
646                         else
647                                 return print("^1ERROR: ^7ANTISPAM CAUGHT: ", command, ".\n"); // "FALSE": not allowed to continue, halt
648         }
649         
650         /* NOTE: totally disabled for now, however the functionality and descriptions are there if we ever want it.
651         if(argv(0) == "help") 
652         {
653                 if(argc == 1) 
654                 {
655                         sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are:\n");
656                         ClientCommand_macro_help;
657                         sprint(self, "For help about specific commands, type cmd help COMMAND\n");
658                         return;
659                 } 
660                 else if(ClientCommand_macro_usage(argc, command)) // Instead of trying to call a command, we're going to see detailed information about it
661                 {
662                         return;
663                 }
664         } 
665         else*/ if(MUTATOR_CALLHOOK(SV_ParseClientCommand))
666         {
667                 return; // handled by a mutator
668         }
669         else if(CheatCommand(argc)) 
670         {
671                 return; // handled by server/cheats.qc
672         }
673         else if(ClientCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
674         {
675                 return; // handled by one of the above ClientCommand_* functions
676         }
677         else
678                 clientcommand(self, command);
679 }