}
}
-void ClientCommand_getmapvotepic(float request, float argc) // internal command, used only by code
+void ClientCommand_mv_getpicture(float request, float argc) // internal command, used only by code
{
switch(request)
{
}
default:
- sprint(self, "Incorrect parameters for ^2getmapvotepic^7\n");
+ sprint(self, "Incorrect parameters for ^2mv_getpicture^7\n");
case CMD_REQUEST_USAGE:
{
- sprint(self, "\nUsage:^3 cmd getmapvotepic mapid\n");
+ sprint(self, "\nUsage:^3 cmd mv_getpicture mapid\n");
sprint(self, " Where 'mapid' is the id number of the map to request an image of on the map vote selection menu.\n");
return;
}
}
}
-void ClientCommand_join(float request) // legacy
+void ClientCommand_join(float request)
{
switch(request)
{
{
if(self.classname != "player" && !lockteams && !g_arena)
{
- if(nJoinAllowed(1))
+ if(nJoinAllowed(self))
{
if(g_ca) { self.caplayer = 1; }
if(autocvar_g_campaign) { campaign_bots_may_start = 1; }
}
}
-void ClientCommand_reportcvar(float request, float argc, string command)
-{
- switch(request)
- {
- case CMD_REQUEST_COMMAND:
- {
- if(argv(1) != "")
- {
- float tokens;
- string s;
-
- 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;
- }
- }
-
- default:
- sprint(self, "Incorrect parameters for ^2reportcvar^7\n");
- case CMD_REQUEST_USAGE:
- {
- sprint(self, "\nUsage:^3 cmd reportcvar <cvar>\n");
- sprint(self, " Where 'cvar' is the cvar plus arguments to send to the server.\n");
- return;
- }
- }
-}
-
void ClientCommand_say(float request, float argc, string command)
{
switch(request)
case "pink": selection = COLOR_TEAM4; break;
case "auto": selection = (-1); break;
- default: break;
+ default: selection = 0; break;
}
if(selection)
{
if(argv(1) != "")
{
- float tokens;
+ //float tokens;
string s;
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);
+ tokenize_console(s);
}
GetCvars(1);
}
}
-void ClientCommand_spectate(float request) // legacy
+void ClientCommand_spectate(float request)
{
switch(request)
{
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)
+ // in CA, allow a dead player to move to spectators (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"))
{
}
else { print_to(self, "You can't ^2tell^7 a message to yourself."); return; }
}
- else if(strtolower(argv(1)) == "world")
+ else if(argv(1) == "#0")
{
- trigger_magicear_processmessage_forallears(self, -1, world, substring(command, argv_start_index(ParseCommandPlayerSlotTarget_firsttoken), argv_end_index(-1) - argv_start_index(ParseCommandPlayerSlotTarget_firsttoken)));
+ trigger_magicear_processmessage_forallears(self, -1, world, substring(command, argv_start_index(next_token), argv_end_index(-1) - argv_start_index(next_token)));
return;
}
else { print_to(self, strcat("tell: ", GetClientErrorString(tell_accepted, argv(1)), ".")); return; }
}
}
-void ClientCommand_voice(float request, float argc, string command) // legacy
+void ClientCommand_voice(float request, float argc, string command)
{
switch(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("getmapvotepic", ClientCommand_getmapvotepic(request, arguments), "Retrieve mapshot picture from the server") \
+ CLIENT_COMMAND("mv_getpicture", ClientCommand_mv_getpicture(request, arguments), "Retrieve mapshot picture from the server") \
CLIENT_COMMAND("join", ClientCommand_join(request), "Become a player in the game") \
CLIENT_COMMAND("ready", ClientCommand_ready(request), "Qualify as ready to end warmup stage (or restart server if allowed)") \
- CLIENT_COMMAND("reportcvar", ClientCommand_reportcvar(request, arguments, command), "Old system for sending a client cvar to the server") \
CLIENT_COMMAND("say", ClientCommand_say(request, arguments, command), "Print a message to chat to all players") \
CLIENT_COMMAND("say_team", ClientCommand_say_team(request, arguments, command), "Print a message to chat to all team mates") \
CLIENT_COMMAND("selectteam", ClientCommand_selectteam(request, arguments), "Attempt to choose a team to join into") \
void SV_ParseClientCommand(string command)
{
+ // if we're banned, don't even parse the command
+ if(Ban_MaybeEnforceBanOnce(self))
+ return;
+
float argc = tokenize_console(command);
+ // for the mutator hook system
+ cmd_name = strtolower(argv(0));
+ cmd_argc = argc;
+ cmd_string = command;
+
// Guide for working with argc arguments by example:
// argc: 1 - 2 - 3 - 4
// argv: 0 - 1 - 2 - 3
// exempt commands which are not subject to floodcheck
case "begin": break; // handled by engine in host_cmd.c
case "download": break; // handled by engine in cl_parse.c
- case "getmapvotepic": break; // handled by server in this file
+ case "mv_getpicture": break; // handled by server in this file
case "pause": break; // handled by engine in host_cmd.c
case "prespawn": break; // handled by engine in host_cmd.c
- 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
if(SV_ParseClientCommand_floodcheck())
break; // "TRUE": continue, as we're not flooding yet
else
- return print("^1ERROR: ^7ANTISPAM CAUGHT: ", command, ".\n"); // "FALSE": not allowed to continue, halt TODO
+ return; // "FALSE": not allowed to continue, halt // print("^1ERROR: ^7ANTISPAM CAUGHT: ", command, ".\n");
}
/* NOTE: should this be disabled? It can be spammy perhaps, but hopefully it's okay for now */
}
else
clientcommand(self, command);
-}
\ No newline at end of file
+}