// =======================================================
// Server side client commands code, reworked by Samual
-// Last updated: November 6th, 2011
+// Last updated: November 8th, 2011
// =======================================================
-#define CC_REQUEST_HELP 1
-#define CC_REQUEST_COMMAND 2
-#define CC_REQUEST_USAGE 3
+#define CC_REQUEST_COMMAND 1
+#define CC_REQUEST_USAGE 2
.float cmd_floodtime;
.float cmd_floodcount;
{
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));
{
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))));
{
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)
{
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);
{
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);
{
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:
{
string command;
{
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)
{
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);
{
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);
{
switch(request)
{
- case CC_REQUEST_HELP:
- {
- sprint(self, " ^2lsnewmaps^7: List maps which TODO\n");
- return;
- }
-
case CC_REQUEST_COMMAND:
{
sprint(self, lsnewmaps_reply);
{
switch(request)
{
- case CC_REQUEST_HELP:
- {
- sprint(self, " ^2maplist^7: Full server maplist reply\n");
- return;
- }
-
case CC_REQUEST_COMMAND:
{
sprint(self, maplist_reply);
{
switch(request)
{
- case CC_REQUEST_HELP:
- {
- sprint(self, " ^2rankings^7: Print information about rankings\n");
- return;
- }
-
case CC_REQUEST_COMMAND:
{
sprint(self, rankings_reply);
{
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)
{
switch(request)
{
- case CC_REQUEST_HELP:
- {
- sprint(self, " ^2records^7: List top 10 records for the current map\n");
- return;
- }
-
case CC_REQUEST_COMMAND:
{
float i;
{
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:
{
float tokens;
{
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); }
{
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); }
{
switch(request)
{
- case CC_REQUEST_HELP:
- {
- sprint(self, " ^2selectteam^7: Attempt to choose a team to join into\n");
- return;
- }
-
case CC_REQUEST_COMMAND:
{
float selection;
{
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:
{
float tokens;
{
switch(request)
{
- case CC_REQUEST_HELP:
- {
- sprint(self, " ^2spectate^7: Become an observer\n");
- return;
- }
-
case CC_REQUEST_COMMAND:
{
if(self.flags & FL_CLIENT)
{
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"));
{
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);
{
switch(request)
{
- case CC_REQUEST_HELP:
- {
- sprint(self, " ^2tell^7: Send a message directly to a player\n");
- return;
- }
-
case CC_REQUEST_COMMAND:
{
entity e = GetCommandPlayerSlotTargetFromTokenizedCommand(argc, 1);
{
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)
{
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)
{
switch(request)
{
- case CC_REQUEST_HELP:
- {
- sprint(self, " ^2voice^7: Send voice message via sound\n");
- return;
- }
-
case CC_REQUEST_COMMAND:
{
if(argc >= 3)
{
switch(request)
{
- case CC_REQUEST_HELP:
- {
- sprint(self, " ^2blah^7: foobar\n");
- return;
- }
-
case CC_REQUEST_COMMAND:
{
// For now, the list has to be split up due to the suckage called fteqcc which limits macros to only 1024 characters
// Do not hard code aliases for these, instead create them in defaultXonotic.cfg... also: keep in alphabetical order, please ;)
#define CLIENT_COMMANDS_1(request,arguments,command) \
- CLIENT_COMMAND("autoswitch", ClientCommand_autoswitch(request, arguments)) \
- CLIENT_COMMAND("checkfail", ClientCommand_checkfail(request, command)) \
- CLIENT_COMMAND("clientversion", ClientCommand_clientversion(request, arguments)) \
- CLIENT_COMMAND("cvar_changes", ClientCommand_cvar_changes(request)) \
- CLIENT_COMMAND("cvar_purechanges", ClientCommand_cvar_purechanges(request)) \
- CLIENT_COMMAND("info", ClientCommand_info(request, arguments)) \
- CLIENT_COMMAND("join", ClientCommand_join(request)) \
- CLIENT_COMMAND("ladder", ClientCommand_ladder(request)) \
- CLIENT_COMMAND("lsmaps", ClientCommand_lsmaps(request)) \
- CLIENT_COMMAND("lsnewmaps", ClientCommand_lsnewmaps(request)) \
- CLIENT_COMMAND("maplist", ClientCommand_maplist(request)) \
- CLIENT_COMMAND("rankings", ClientCommand_rankings(request)) \
- CLIENT_COMMAND("ready", ClientCommand_ready(request)) \
+ CLIENT_COMMAND("autoswitch", ClientCommand_autoswitch(request, arguments), "Whether or not to switch automatically when getting a better weapon") \
+ CLIENT_COMMAND("checkfail", ClientCommand_checkfail(request, command), "Report if a client-side check failed") \
+ CLIENT_COMMAND("clientversion", ClientCommand_clientversion(request, arguments), "Release version of the game") \
+ CLIENT_COMMAND("cvar_changes", ClientCommand_cvar_changes(request), "Prints a list of all changed server cvars") \
+ CLIENT_COMMAND("cvar_purechanges", ClientCommand_cvar_purechanges(request), "Prints a list of all changed gameplay cvars") \
+ CLIENT_COMMAND("info", ClientCommand_info(request, arguments), "Request for unique server information set up by admin") \
+ CLIENT_COMMAND("join", ClientCommand_join(request), "Become a player in the game") \
+ CLIENT_COMMAND("ladder", ClientCommand_ladder(request), "Get information about top players if supported") \
/* nothing */
-
+
#define CLIENT_COMMANDS_2(request,arguments,command) \
- CLIENT_COMMAND("records", ClientCommand_records(request)) \
- CLIENT_COMMAND("reportcvar", ClientCommand_reportcvar(request, arguments, command)) \
- CLIENT_COMMAND("say", ClientCommand_say(request, arguments, command)) \
- CLIENT_COMMAND("say_team", ClientCommand_say_team(request, arguments, command)) \
- CLIENT_COMMAND("selectteam", ClientCommand_selectteam(request, arguments)) \
- CLIENT_COMMAND("sentcvar", ClientCommand_sentcvar(request, arguments, command)) \
- CLIENT_COMMAND("spectate", ClientCommand_spectate(request)) \
- CLIENT_COMMAND("suggestmap", ClientCommand_suggestmap(request, arguments)) \
- CLIENT_COMMAND("teamstatus", ClientCommand_teamstatus(request)) \
- CLIENT_COMMAND("tell", ClientCommand_tell(request, arguments, command)) \
- CLIENT_COMMAND("timein", ClientCommand_timein(request)) \
- CLIENT_COMMAND("timeout", ClientCommand_timeout(request)) \
+ CLIENT_COMMAND("lsmaps", ClientCommand_lsmaps(request), "List maps which can be used with the current game mode") \
+ CLIENT_COMMAND("lsnewmaps", ClientCommand_lsnewmaps(request), "List maps which TODO") \
+ CLIENT_COMMAND("maplist", ClientCommand_maplist(request), "Full server maplist reply") \
+ CLIENT_COMMAND("rankings", ClientCommand_rankings(request), "Print information about rankings") \
+ CLIENT_COMMAND("ready", ClientCommand_ready(request), "Qualify as ready to end warmup stage (or restart server if allowed)") \
+ CLIENT_COMMAND("records", ClientCommand_records(request), "List top 10 records for the current map") \
+ CLIENT_COMMAND("reportcvar", ClientCommand_reportcvar(request, arguments, command), "Old system for sending a client cvar to the server") \
+ CLIENT_COMMAND("say", ClientCommand_say(request, arguments, command), "Print a message to chat to all players") \
/* nothing */
-
+
#define CLIENT_COMMANDS_3(request,arguments,command) \
- CLIENT_COMMAND("voice", ClientCommand_voice(request, arguments, command)) \
+ CLIENT_COMMAND("say_team", ClientCommand_say_team(request, arguments, command), "Print a message to chat to all team mates") \
+ CLIENT_COMMAND("selectteam", ClientCommand_selectteam(request, arguments), "Attempt to choose a team to join into") \
+ CLIENT_COMMAND("sentcvar", ClientCommand_sentcvar(request, arguments, command), "New system for sending a client cvar to the server") \
+ CLIENT_COMMAND("spectate", ClientCommand_spectate(request), "Become an observer") \
+ CLIENT_COMMAND("suggestmap", ClientCommand_suggestmap(request, arguments), "Suggest a map to the mapvote at match end") \
+ CLIENT_COMMAND("teamstatus", ClientCommand_teamstatus(request), "Print detailed score information for all players") \
+ CLIENT_COMMAND("tell", ClientCommand_tell(request, arguments, command), "Send a message directly to a player") \
+ CLIENT_COMMAND("timein", ClientCommand_timein(request), "Resume the game from being paused with a timeout") \
+ /* nothing */
+
+#define CLIENT_COMMANDS_4(request,arguments,command) \
+ CLIENT_COMMAND("timeout", ClientCommand_timeout(request), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
+ CLIENT_COMMAND("voice", ClientCommand_voice(request, arguments, command), "Send voice message via sound") \
/* nothing */
void ClientCommand_macro_help()
{
- #define CLIENT_COMMAND(name,function) \
- { function; }
+ #define CLIENT_COMMAND(name,function,description) \
+ { print(" ^2", name, "^7: ", description, "\n"); }
- CLIENT_COMMANDS_1(CC_REQUEST_HELP, 0, "")
- CLIENT_COMMANDS_2(CC_REQUEST_HELP, 0, "")
- CLIENT_COMMANDS_3(CC_REQUEST_HELP, 0, "")
+ CLIENT_COMMANDS_1(0, 0, "")
+ CLIENT_COMMANDS_2(0, 0, "")
+ CLIENT_COMMANDS_3(0, 0, "")
+ CLIENT_COMMANDS_4(0, 0, "")
#undef CLIENT_COMMAND
return;
float ClientCommand_macro_command(float argc, string command)
{
- #define CLIENT_COMMAND(name,function) \
+ #define CLIENT_COMMAND(name,function,description) \
{ if(name == strtolower(argv(0))) { function; return TRUE; } }
CLIENT_COMMANDS_1(CC_REQUEST_COMMAND, argc, command)
CLIENT_COMMANDS_2(CC_REQUEST_COMMAND, argc, command)
CLIENT_COMMANDS_3(CC_REQUEST_COMMAND, argc, command)
+ CLIENT_COMMANDS_4(CC_REQUEST_COMMAND, argc, command)
#undef CLIENT_COMMAND
return FALSE;
float ClientCommand_macro_usage(float argc, string command)
{
- #define CLIENT_COMMAND(name,function) \
+ #define CLIENT_COMMAND(name,function,description) \
{ if(name == strtolower(argv(1))) { function; return TRUE; } }
CLIENT_COMMANDS_1(CC_REQUEST_USAGE, argc, command)
CLIENT_COMMANDS_2(CC_REQUEST_USAGE, argc, command)
CLIENT_COMMANDS_3(CC_REQUEST_USAGE, argc, command)
+ CLIENT_COMMANDS_4(CC_REQUEST_USAGE, argc, command)
#undef CLIENT_COMMAND
return FALSE;