]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/command/common.qc
Remove pre/post includes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / common.qc
1 #if defined(CSQC)
2 #elif defined(MENUQC)
3 #elif defined(SVQC)
4         #include "../../dpdefs/progsdefs.qh"
5     #include "../../dpdefs/dpextensions.qh"
6     #include "../../common/util.qh"
7     #include "../../common/counting.qh"
8     #include "../../common/command/shared_defs.qh"
9     #include "../autocvars.qh"
10     #include "../defs.qh"
11     #include "../../common/notifications.qh"
12     #include "common.qh"
13     #include "vote.qh"
14     #include "../scores.qh"
15 #endif
16
17 // ====================================================
18 //  Shared code for server commands, written by Samual
19 //  Last updated: December 27th, 2011
20 // ====================================================
21
22 // select the proper prefix for usage and other messages
23 string GetCommandPrefix(entity caller)
24 {
25         if(caller)
26                 return "cmd";
27         else
28                 return "sv_cmd";
29 }
30
31 // if client return player nickname, or if server return admin nickname
32 string GetCallerName(entity caller)
33 {
34         if(caller)
35                 return caller.netname;
36         else
37                 return admin_name(); //((autocvar_sv_adminnick != "") ? autocvar_sv_adminnick : autocvar_hostname);
38 }
39
40 // verify that the client provided is acceptable for use
41 float VerifyClientEntity(entity client, float must_be_real, float must_be_bots)
42 {
43         if (!IS_CLIENT(client))
44                 return CLIENT_DOESNT_EXIST;
45         else if(must_be_real && !IS_REAL_CLIENT(client))
46                 return CLIENT_NOT_REAL;
47         else if(must_be_bots && !IS_BOT_CLIENT(client))
48                 return CLIENT_NOT_BOT;
49
50         return CLIENT_ACCEPTABLE;
51 }
52
53 // if the client is not acceptable, return a string to be used for error messages
54 string GetClientErrorString(float clienterror, string original_input)
55 {
56         switch(clienterror)
57         {
58                 case CLIENT_DOESNT_EXIST: { return strcat("Client '", original_input, "' doesn't exist"); }
59                 case CLIENT_NOT_REAL: { return strcat("Client '", original_input, "' is not real"); }
60                 case CLIENT_NOT_BOT: { return strcat("Client '", original_input, "' is not a bot"); }
61                 default: { return "Incorrect usage of GetClientErrorString"; }
62         }
63 }
64
65 // is this entity number even in the possible range of entities?
66 float VerifyClientNumber(float tmp_number)
67 {
68         if((tmp_number < 1) || (tmp_number > maxclients))
69                 return false;
70         else
71                 return true;
72 }
73
74 entity GetIndexedEntity(float argc, float start_index)
75 {
76         entity tmp_player, selection;
77         float tmp_number, index;
78         string tmp_string;
79
80         next_token = -1;
81         index = start_index;
82         selection = world;
83
84         if(argc > start_index)
85         {
86                 if(substring(argv(index), 0, 1) == "#")
87                 {
88                         tmp_string = substring(argv(index), 1, -1);
89                         ++index;
90
91                         if(tmp_string != "") // is it all one token? like #1
92                         {
93                                 tmp_number = stof(tmp_string);
94                         }
95                         else if(argc > index) // no, it's two tokens? # 1
96                         {
97                                 tmp_number = stof(argv(index));
98                                 ++index;
99                         }
100                         else
101                                 tmp_number = 0;
102                 }
103                 else // maybe it's ONLY a number?
104                 {
105                         tmp_number = stof(argv(index));
106                         ++index;
107                 }
108
109                 if(VerifyClientNumber(tmp_number))
110                 {
111                         selection = edict_num(tmp_number); // yes, it was a number
112                 }
113                 else // no, maybe it's a name?
114                 {
115                         FOR_EACH_CLIENT(tmp_player)
116                                 if (strdecolorize(tmp_player.netname) == strdecolorize(argv(start_index)))
117                                         selection = tmp_player;
118
119                         index = (start_index + 1);
120                 }
121         }
122
123         next_token = index;
124         //print(strcat("start_index: ", ftos(start_index), ", next_token: ", ftos(next_token), ", edict: ", ftos(num_for_edict(selection)), ".\n"));
125         return selection;
126 }
127
128 // find a player which matches the input string, and return their entity
129 entity GetFilteredEntity(string input)
130 {
131         entity tmp_player, selection;
132         float tmp_number;
133
134         if(substring(input, 0, 1) == "#")
135                 tmp_number = stof(substring(input, 1, -1));
136         else
137                 tmp_number = stof(input);
138
139         if(VerifyClientNumber(tmp_number))
140         {
141                 selection = edict_num(tmp_number);
142         }
143         else
144         {
145                 selection = world;
146                 FOR_EACH_CLIENT(tmp_player)
147                         if (strdecolorize(tmp_player.netname) == strdecolorize(input))
148                                 selection = tmp_player;
149         }
150
151         return selection;
152 }
153
154 // same thing, but instead return their edict number
155 float GetFilteredNumber(string input)
156 {
157         entity selection = GetFilteredEntity(input);
158         float output;
159
160         output = num_for_edict(selection);
161
162         return output;
163 }
164
165 // switch between sprint and print depending on whether the receiver is the server or a player
166 void print_to(entity to, string input)
167 {
168     if(to)
169         sprint(to, strcat(input, "\n"));
170     else
171         print(input, "\n");
172 }
173
174 // ==========================================
175 //  Supporting functions for common commands
176 // ==========================================
177
178 // used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such.
179 void timeout_handler_reset()
180 {
181         timeout_caller = world;
182         timeout_time = 0;
183         timeout_leadtime = 0;
184
185         remove(self);
186 }
187
188 void timeout_handler_think()
189 {
190         entity tmp_player;
191
192         switch(timeout_status)
193         {
194                 case TIMEOUT_ACTIVE:
195                 {
196                         if(timeout_time > 0) // countdown is still going
197                         {
198                                 Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_TIMEOUT_ENDING, timeout_time);
199
200                                 if(timeout_time == autocvar_sv_timeout_resumetime) // play a warning sound when only <sv_timeout_resumetime> seconds are left
201                                         Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_PREPARE);
202
203                                 self.nextthink = time + TIMEOUT_SLOWMO_VALUE; // think again in one second
204                                 timeout_time -= 1; // decrease the time counter
205                         }
206                         else // time to end the timeout
207                         {
208                                 timeout_status = TIMEOUT_INACTIVE;
209
210                                 // reset the slowmo value back to normal
211                                 cvar_set("slowmo", ftos(orig_slowmo));
212
213                                 // unlock the view for players so they can move around again
214                                 FOR_EACH_REALPLAYER(tmp_player)
215                                         tmp_player.fixangle = false;
216
217                                 timeout_handler_reset();
218                         }
219
220                         return;
221                 }
222
223                 case TIMEOUT_LEADTIME:
224                 {
225                         if(timeout_leadtime > 0) // countdown is still going
226                         {
227                                 Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_TIMEOUT_BEGINNING, timeout_leadtime);
228
229                                 self.nextthink = time + 1; // think again in one second
230                                 timeout_leadtime -= 1; // decrease the time counter
231                         }
232                         else // time to begin the timeout
233                         {
234                                 timeout_status = TIMEOUT_ACTIVE;
235
236                                 // set the slowmo value to the timeout default slowmo value
237                                 cvar_set("slowmo", ftos(TIMEOUT_SLOWMO_VALUE));
238
239                                 // reset all the flood variables
240                                 FOR_EACH_CLIENT(tmp_player)
241                                         tmp_player.nickspamcount = tmp_player.nickspamtime = tmp_player.floodcontrol_chat =
242                                         tmp_player.floodcontrol_chatteam = tmp_player.floodcontrol_chattell =
243                                         tmp_player.floodcontrol_voice = tmp_player.floodcontrol_voiceteam = 0;
244
245                                 // copy .v_angle to .lastV_angle for every player in order to fix their view during pause (see PlayerPreThink)
246                                 FOR_EACH_REALPLAYER(tmp_player)
247                                         tmp_player.lastV_angle = tmp_player.v_angle;
248
249                                 self.nextthink = time; // think again next frame to handle it under TIMEOUT_ACTIVE code
250                         }
251
252                         return;
253                 }
254
255
256                 case TIMEOUT_INACTIVE:
257                 default:
258                 {
259                         timeout_handler_reset();
260                         return;
261                 }
262         }
263 }
264
265
266
267 // ===================================================
268 //  Common commands used in both sv_cmd.qc and cmd.qc
269 // ===================================================
270
271 void CommonCommand_cvar_changes(float request, entity caller)
272 {
273         switch(request)
274         {
275                 case CMD_REQUEST_COMMAND:
276                 {
277                         print_to(caller, cvar_changes);
278                         return; // never fall through to usage
279                 }
280
281                 default:
282                 case CMD_REQUEST_USAGE:
283                 {
284                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " cvar_changes"));
285                         print_to(caller, "  No arguments required.");
286                         print_to(caller, "See also: ^2cvar_purechanges^7");
287                         return;
288                 }
289         }
290 }
291
292 void CommonCommand_cvar_purechanges(float request, entity caller)
293 {
294         switch(request)
295         {
296                 case CMD_REQUEST_COMMAND:
297                 {
298                         print_to(caller, cvar_purechanges);
299                         return; // never fall through to usage
300                 }
301
302                 default:
303                 case CMD_REQUEST_USAGE:
304                 {
305                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " cvar_purechanges"));
306                         print_to(caller, "  No arguments required.");
307                         print_to(caller, "See also: ^2cvar_changes^7");
308                         return;
309                 }
310         }
311 }
312
313 void CommonCommand_info(float request, entity caller, float argc)
314 {
315         switch(request)
316         {
317                 case CMD_REQUEST_COMMAND:
318                 {
319                         string command = builtin_cvar_string(strcat("sv_info_", argv(1)));
320
321                         if(command)
322                                 wordwrap_sprint(command, 1000);
323                         else
324                                 print_to(caller, "ERROR: unsupported info command");
325
326                         return; // never fall through to usage
327                 }
328
329                 default:
330                 case CMD_REQUEST_USAGE:
331                 {
332                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " info request"));
333                         print_to(caller, "  Where 'request' is the suffixed string appended onto the request for cvar.");
334                         return;
335                 }
336         }
337 }
338
339 void CommonCommand_ladder(float request, entity caller)
340 {
341         switch(request)
342         {
343                 case CMD_REQUEST_COMMAND:
344                 {
345                         print_to(caller, ladder_reply);
346                         return; // never fall through to usage
347                 }
348
349                 default:
350                 case CMD_REQUEST_USAGE:
351                 {
352                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " ladder"));
353                         print_to(caller, "  No arguments required.");
354                         return;
355                 }
356         }
357 }
358
359 void CommonCommand_lsmaps(float request, entity caller)
360 {
361         switch(request)
362         {
363                 case CMD_REQUEST_COMMAND:
364                 {
365                         print_to(caller, lsmaps_reply);
366                         return; // never fall through to usage
367                 }
368
369                 default:
370                 case CMD_REQUEST_USAGE:
371                 {
372                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " lsmaps"));
373                         print_to(caller, "  No arguments required.");
374                         return;
375                 }
376         }
377 }
378
379 void CommonCommand_printmaplist(float request, entity caller)
380 {
381         switch(request)
382         {
383                 case CMD_REQUEST_COMMAND:
384                 {
385                         print_to(caller, maplist_reply);
386                         return; // never fall through to usage
387                 }
388
389                 default:
390                 case CMD_REQUEST_USAGE:
391                 {
392                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " printmaplist"));
393                         print_to(caller, "  No arguments required.");
394                         return;
395                 }
396         }
397 }
398
399 void CommonCommand_rankings(float request, entity caller)
400 {
401         switch(request)
402         {
403                 case CMD_REQUEST_COMMAND:
404                 {
405                         print_to(caller, rankings_reply);
406                         return; // never fall through to usage
407                 }
408
409                 default:
410                 case CMD_REQUEST_USAGE:
411                 {
412                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " rankings"));
413                         print_to(caller, "  No arguments required.");
414                         return;
415                 }
416         }
417 }
418
419 void CommonCommand_records(float request, entity caller)
420 {
421         switch(request)
422         {
423                 case CMD_REQUEST_COMMAND:
424                 {
425                         float i;
426
427                         for(i = 0; i < 10; ++i)
428                                 if(records_reply[i] != "")
429                                         print_to(caller, records_reply[i]);
430
431                         return; // never fall through to usage
432                 }
433
434                 default:
435                 case CMD_REQUEST_USAGE:
436                 {
437                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " records"));
438                         print_to(caller, "  No arguments required.");
439                         return;
440                 }
441         }
442 }
443
444 void CommonCommand_teamstatus(float request, entity caller)
445 {
446         switch(request)
447         {
448                 case CMD_REQUEST_COMMAND:
449                 {
450                         Score_NicePrint(caller);
451                         return; // never fall through to usage
452                 }
453
454                 default:
455                 case CMD_REQUEST_USAGE:
456                 {
457                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " teamstatus"));
458                         print_to(caller, "  No arguments required.");
459                         return;
460                 }
461         }
462 }
463
464 void CommonCommand_time(float request, entity caller)
465 {
466         switch(request)
467         {
468                 case CMD_REQUEST_COMMAND:
469                 {
470                         print_to(caller, strcat("time = ", ftos(time)));
471                         print_to(caller, strcat("frame start = ", ftos(gettime(GETTIME_FRAMESTART))));
472                         print_to(caller, strcat("realtime = ", ftos(gettime(GETTIME_REALTIME))));
473                         print_to(caller, strcat("hires = ", ftos(gettime(GETTIME_HIRES))));
474                         print_to(caller, strcat("uptime = ", ftos(gettime(GETTIME_UPTIME))));
475                         print_to(caller, strcat("localtime = ", strftime(true, "%a %b %e %H:%M:%S %Z %Y")));
476                         print_to(caller, strcat("gmtime = ", strftime(false, "%a %b %e %H:%M:%S %Z %Y")));
477                         return;
478                 }
479
480                 default:
481                 case CMD_REQUEST_USAGE:
482                 {
483                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " time"));
484                         print_to(caller, "  No arguments required.");
485                         return;
486                 }
487         }
488 }
489
490 void CommonCommand_timein(float request, entity caller)
491 {
492         switch(request)
493         {
494                 case CMD_REQUEST_COMMAND:
495                 {
496                         if(!caller || autocvar_sv_timeout)
497                         {
498                                 if (!timeout_status) { print_to(caller, "^7Error: There is no active timeout called."); }
499                                 else if(caller && (caller != timeout_caller)) { print_to(caller, "^7Error: You are not allowed to stop the active timeout."); }
500
501                                 else // everything should be okay, continue aborting timeout
502                                 {
503                                         switch(timeout_status)
504                                         {
505                                                 case TIMEOUT_LEADTIME:
506                                                 {
507                                                         timeout_status = TIMEOUT_INACTIVE;
508                                                         timeout_time = 0;
509                                                         timeout_handler.nextthink = time; // timeout_handler has to take care of it immediately
510                                                         bprint(strcat("^7The timeout was aborted by ", GetCallerName(caller), " !\n"));
511                                                         return;
512                                                 }
513
514                                                 case TIMEOUT_ACTIVE:
515                                                 {
516                                                         timeout_time = autocvar_sv_timeout_resumetime;
517                                                         timeout_handler.nextthink = time; // timeout_handler has to take care of it immediately
518                                                         bprint(strcat("^1Attention: ^7", GetCallerName(caller), " resumed the game! Prepare for battle!\n"));
519                                                         return;
520                                                 }
521
522                                                 default: dprint("timeout status was inactive, but this code was executed anyway?"); return;
523                                         }
524                                 }
525                         }
526                         else { print_to(caller, "^1Timeins are not allowed to be called, enable them with sv_timeout 1.\n"); }
527
528                         return; // never fall through to usage
529                 }
530
531                 default:
532                 case CMD_REQUEST_USAGE:
533                 {
534                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " timein"));
535                         print_to(caller, "  No arguments required.");
536                         return;
537                 }
538         }
539 }
540
541 void CommonCommand_timeout(float request, entity caller) // DEAR GOD THIS COMMAND IS TERRIBLE.
542 {
543         switch(request)
544         {
545                 case CMD_REQUEST_COMMAND:
546                 {
547                         if(!caller || autocvar_sv_timeout)
548                         {
549                                 float last_possible_timeout = ((autocvar_timelimit * 60) - autocvar_sv_timeout_leadtime - 1);
550
551                                 if(timeout_status) { print_to(caller, "^7Error: A timeout is already active."); }
552                                 else if(vote_called) { print_to(caller, "^7Error: You can not call a timeout while a vote is active."); }
553                                 else if(warmup_stage && !g_warmup_allow_timeout) { print_to(caller, "^7Error: You can not call a timeout in warmup-stage."); }
554                                 else if(time < game_starttime) { print_to(caller, "^7Error: You can not call a timeout while the map is being restarted."); }
555                                 else if(caller && (caller.allowed_timeouts < 1)) { print_to(caller, "^7Error: You already used all your timeout calls for this map."); }
556                                 else if(caller && !IS_PLAYER(caller)) { print_to(caller, "^7Error: You must be a player to call a timeout."); }
557                                 else if((autocvar_timelimit) && (last_possible_timeout < time - game_starttime)) { print_to(caller, "^7Error: It is too late to call a timeout now!"); }
558
559                                 else // everything should be okay, proceed with starting the timeout
560                                 {
561                                         if(caller) { caller.allowed_timeouts -= 1; }
562
563                                         bprint(GetCallerName(caller), " ^7called a timeout", (caller ? strcat(" (", ftos(caller.allowed_timeouts), " timeout(s) left)") : ""), "!\n"); // write a bprint who started the timeout (and how many they have left)
564
565                                         timeout_status = TIMEOUT_LEADTIME;
566                                         timeout_caller = caller;
567                                         timeout_time = autocvar_sv_timeout_length;
568                                         timeout_leadtime = autocvar_sv_timeout_leadtime;
569
570                                         timeout_handler = spawn();
571                                         timeout_handler.think = timeout_handler_think;
572                                         timeout_handler.nextthink = time; // always let the entity think asap
573
574                                         Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_TIMEOUT);
575                                 }
576                         }
577                         else { print_to(caller, "^1Timeouts are not allowed to be called, enable them with sv_timeout 1.\n"); }
578
579                         return; // never fall through to usage
580                 }
581
582                 default:
583                 case CMD_REQUEST_USAGE:
584                 {
585                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " timeout"));
586                         print_to(caller, "  No arguments required.");
587                         return;
588                 }
589         }
590 }
591
592 void CommonCommand_who(float request, entity caller, float argc)
593 {
594         switch(request)
595         {
596                 case CMD_REQUEST_COMMAND:
597                 {
598                         float total_listed_players, is_bot;
599                         entity tmp_player;
600
601                         float privacy = (caller && autocvar_sv_status_privacy);
602                         string separator = strreplace("%", " ", strcat((argv(1) ? argv(1) : " "), "^7"));
603                         string tmp_netaddress, tmp_crypto_idfp;
604
605                         print_to(caller, strcat("List of client information", (privacy ? " (some data is hidden for privacy)" : ""), ":"));
606                         print_to(caller, sprintf(strreplace(" ", separator, " %-4s %-20s %-5s %-3s %-9s %-16s %s "),
607                                 "ent", "nickname", "ping", "pl", "time", "ip", "crypto_id"));
608
609                         total_listed_players = 0;
610                         FOR_EACH_CLIENT(tmp_player)
611                         {
612                                 is_bot = (IS_BOT_CLIENT(tmp_player));
613
614                                 if(is_bot)
615                                 {
616                                         tmp_netaddress = "null/botclient";
617                                         tmp_crypto_idfp = "null/botclient";
618                                 }
619                                 else if(privacy)
620                                 {
621                                         tmp_netaddress = "hidden";
622                                         tmp_crypto_idfp = "hidden";
623                                 }
624                                 else
625                                 {
626                                         tmp_netaddress = tmp_player.netaddress;
627                                         tmp_crypto_idfp = tmp_player.crypto_idfp;
628                                 }
629
630                                 print_to(caller, sprintf(strreplace(" ", separator, " #%-3d %-20.20s %-5d %-3d %-9s %-16s %s "),
631                                         num_for_edict(tmp_player),
632                                         tmp_player.netname,
633                                         tmp_player.ping,
634                                         tmp_player.ping_packetloss,
635                                         process_time(1, time - tmp_player.jointime),
636                                         tmp_netaddress,
637                                         tmp_crypto_idfp));
638
639                                 ++total_listed_players;
640                         }
641
642                         print_to(caller, strcat("Finished listing ", ftos(total_listed_players), " client(s) out of ", ftos(maxclients), " slots."));
643
644                         return; // never fall through to usage
645                 }
646
647                 default:
648                 case CMD_REQUEST_USAGE:
649                 {
650                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " who [separator]"));
651                         print_to(caller, "  Where 'separator' is the optional string to separate the values with, default is a space.");
652                         return;
653                 }
654         }
655 }
656
657 /* use this when creating a new command, making sure to place it in alphabetical order... also,
658 ** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION!
659 void CommonCommand_(float request, entity caller)
660 {
661         switch(request)
662         {
663                 case CMD_REQUEST_COMMAND:
664                 {
665
666                         return; // never fall through to usage
667                 }
668
669                 default:
670                 case CMD_REQUEST_USAGE:
671                 {
672                         print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " "));
673                         print_to(caller, "  No arguments required.");
674                         return;
675                 }
676         }
677 }
678 */
679
680
681 // ==================================
682 //  Macro system for common commands
683 // ==================================
684
685 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
686 #define COMMON_COMMANDS(request,caller,arguments,command) \
687         COMMON_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, caller), "Prints a list of all changed server cvars") \
688         COMMON_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, caller), "Prints a list of all changed gameplay cvars") \
689         COMMON_COMMAND("info", CommonCommand_info(request, caller, arguments), "Request for unique server information set up by admin") \
690         COMMON_COMMAND("ladder", CommonCommand_ladder(request, caller), "Get information about top players if supported") \
691         COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, caller), "List maps which can be used with the current game mode") \
692         COMMON_COMMAND("printmaplist", CommonCommand_printmaplist(request, caller), "Display full server maplist reply") \
693         COMMON_COMMAND("rankings", CommonCommand_rankings(request, caller), "Print information about rankings") \
694         COMMON_COMMAND("records", CommonCommand_records(request, caller), "List top 10 records for the current map") \
695         COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, caller), "Show information about player and team scores") \
696         COMMON_COMMAND("time", CommonCommand_time(request, caller), "Print different formats/readouts of time") \
697         COMMON_COMMAND("timein", CommonCommand_timein(request, caller), "Resume the game from being paused with a timeout") \
698         COMMON_COMMAND("timeout", CommonCommand_timeout(request, caller), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
699         COMMON_COMMAND("vote", VoteCommand(request, caller, arguments, command), "Request an action to be voted upon by players") \
700         COMMON_COMMAND("who", CommonCommand_who(request, caller, arguments), "Display detailed client information about all players") \
701         /* nothing */
702
703 void CommonCommand_macro_help(entity caller)
704 {
705         #define COMMON_COMMAND(name,function,description) \
706                 { print_to(caller, strcat("  ^2", name, "^7: ", description)); }
707
708         COMMON_COMMANDS(0, caller, 0, "");
709         #undef COMMON_COMMAND
710
711         return;
712 }
713
714 float CommonCommand_macro_command(float argc, entity caller, string command)
715 {
716         #define COMMON_COMMAND(name,function,description) \
717                 { if(name == strtolower(argv(0))) { function; return true; } }
718
719         COMMON_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, command);
720         #undef COMMON_COMMAND
721
722         return false;
723 }
724
725 float CommonCommand_macro_usage(float argc, entity caller)
726 {
727         #define COMMON_COMMAND(name,function,description) \
728                 { if(name == strtolower(argv(1))) { function; return true; } }
729
730         COMMON_COMMANDS(CMD_REQUEST_USAGE, caller, argc, "");
731         #undef COMMON_COMMAND
732
733         return false;
734 }
735
736 void CommonCommand_macro_write_aliases(float fh)
737 {
738         #define COMMON_COMMAND(name,function,description) \
739                 { CMD_Write_Alias("qc_cmd_svcmd", name, description); }
740
741         COMMON_COMMANDS(0, world, 0, "");
742         #undef COMMON_COMMAND
743
744         return;
745 }