X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcommand%2Fcmd.qc;h=4cb66508961208c521710164013dcd8da3aa2961;hb=3aed354c1125db3e6e862f552c253b06b09d5d86;hp=e885c3054b7406318ea12ae69e28a2e60e7a93ce;hpb=2242b9cc6358009eaa7068bd9e58384c4b4092e8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index e885c3054..4cb665089 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -90,7 +90,7 @@ void ClientCommand_clientversion(float request, float argc) // internal command, self.version_mismatch = 1; ClientKill_TeamChange(-2); // observe } - else if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force) + else if(autocvar_g_campaign || autocvar_g_balance_teams) { //JoinBestTeam(self, FALSE, TRUE); } @@ -154,18 +154,19 @@ void ClientCommand_join(float request) { if(nJoinAllowed(self)) { - 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"); + Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD); + Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_PREVENT_JOIN); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_JOIN_PLAY, self.netname); PutClientInServer(); } else { //player may not join because of g_maxplayers is set - centerprint(self, PREVENT_JOIN_TEXT); + Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_PREVENT_JOIN); } } } @@ -194,6 +195,8 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes { if(!readyrestart_happened || autocvar_sv_ready_restart_repeatable) { + if(time < game_starttime + 1) // game is already restarting + return; if (self.ready) // toggle { self.ready = FALSE; @@ -226,40 +229,6 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes } } -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 \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) @@ -318,13 +287,13 @@ void ClientCommand_selectteam(float request, float argc) 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 "red": selection = NUM_TEAM_1; break; + case "blue": selection = NUM_TEAM_2; break; + case "yellow": selection = NUM_TEAM_3; break; + case "pink": selection = NUM_TEAM_4; break; case "auto": selection = (-1); break; - default: break; + default: selection = 0; break; } if(selection) @@ -392,13 +361,13 @@ void ClientCommand_sentcvar(float request, float argc, string command) { 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); @@ -431,6 +400,8 @@ void ClientCommand_spectate(float request) { if(self.lms_spectate_warning) { + // for the forfeit message... + self.lms_spectate_warning = 2; // mark player as spectator PlayerScore_Add(self, SP_LMS_RANK, 666 - PlayerScore_Add(self, SP_LMS_RANK, 0)); } @@ -444,10 +415,10 @@ void ClientCommand_spectate(float request) if(self.classname == "player" && autocvar_sv_spectate == 1) ClientKill_TeamChange(-2); // observe - + // 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")) + if(self.caplayer && (self.classname == "spectator" || self.classname == "observer")) { sprint(self, "WARNING: you will spectate in the next round.\n"); self.caplayer = 0; @@ -595,7 +566,6 @@ void ClientCommand_(float request) 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") \ @@ -658,6 +628,10 @@ void ClientCommand_macro_write_aliases(float fh) 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 @@ -679,7 +653,6 @@ void SV_ParseClientCommand(string command) 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