X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcommand%2Fcmd.qc;h=eba74cd3860b76424f5600dd302e237e9142e9db;hb=49af10f3413b96e52055359d42288dbf5ec6972b;hp=530646afd2ec8fbb105dc8a080b41dadaaa25d0f;hpb=8dd9e564bf844bd71312218ce4714e6324d6beb5;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 530646afd..4850049e5 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -81,7 +81,7 @@ void ClientCommand_clientversion(float request, float argc) // internal command, { if(argv(1) != "") { - if(self.flags & FL_CLIENT) + if(IS_CLIENT(self)) { self.version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1))); @@ -148,24 +148,24 @@ void ClientCommand_join(float request) { case CMD_REQUEST_COMMAND: { - if(self.flags & FL_CLIENT) + if(IS_CLIENT(self)) { - if(self.classname != "player" && !lockteams && !g_arena) + if(!IS_PLAYER(self) && !lockteams && !g_arena) { 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_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, CENTER_JOIN_PREVENT); } } } @@ -188,12 +188,14 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes { case CMD_REQUEST_COMMAND: { - if(self.flags & FL_CLIENT) + if(IS_CLIENT(self)) { - if(inWarmupStage || autocvar_sv_ready_restart || g_race_qualifying == 2) + if(warmup_stage || autocvar_sv_ready_restart || g_race_qualifying == 2) { if(!readyrestart_happened || autocvar_sv_ready_restart_repeatable) { + if(time < game_starttime) // game is already restarting + return; if (self.ready) // toggle { self.ready = FALSE; @@ -274,7 +276,7 @@ void ClientCommand_selectteam(float request, float argc) { if(argv(1) != "") { - if(self.flags & FL_CLIENT) + if(IS_CLIENT(self)) { if(teamplay) if not(self.team_forced > 0) @@ -284,10 +286,10 @@ 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: selection = 0; break; @@ -390,13 +392,15 @@ void ClientCommand_spectate(float request) { case CMD_REQUEST_COMMAND: { - if(self.flags & FL_CLIENT) + if(IS_CLIENT(self)) { if(g_arena) { return; } if(g_lms) { 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)); } @@ -408,12 +412,12 @@ void ClientCommand_spectate(float request) } } - if(self.classname == "player" && autocvar_sv_spectate == 1) + if(IS_PLAYER(self) && 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 && (IS_SPEC(self) || IS_OBSERVER(self))) { sprint(self, "WARNING: you will spectate in the next round.\n"); self.caplayer = 0;