X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=ba6c2e5781486f7e037c3c21e0a0b7e2b0d5bbac;hp=430913466f1475f01db7c449f3a25f14bb753aba;hb=d196e0b6846e4175aa65b986ab985fc6fefb7656;hpb=16496d2a82fba46621a4096a9de394ef400c0b1e diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 430913466f..ba6c2e5781 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1222,6 +1222,7 @@ Called when a client types 'kill' in the console ============= */ +.float clientkill_nexttime; void ClientKill_Now_TeamChange() { if(self.killindicator_teamchange == -1) @@ -1229,6 +1230,14 @@ void ClientKill_Now_TeamChange() self.team = -1; JoinBestTeam( self, FALSE, FALSE ); } + else if(self.killindicator_teamchange == -2) + { + if(g_ca) + self.caplayer = 0; + if(blockSpectators) + sprint(self, strcat("^7You have to become a player within the next ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n")); + PutObserverInServer(); + } else SV_ChangeTeam(self.killindicator_teamchange - 1); } @@ -1263,6 +1272,11 @@ void KillIndicator_Think() ClientKill_Now(); // no oldself needed return; } + else if(g_cts && self.health == 1) // health == 1 means that it's silent + { + self.nextthink = time + 1; + self.cnt -= 1; + } else { if(self.cnt <= 10) @@ -1275,6 +1289,8 @@ void KillIndicator_Think() { if(self.owner.killindicator_teamchange == -1) centerprint(self.owner, strcat("Changing team in ", ftos(self.cnt), " seconds")); + else if(self.owner.killindicator_teamchange == -2) + centerprint(self.owner, strcat("Spectating in ", ftos(self.cnt), " seconds")); else centerprint(self.owner, strcat("Changing to ", ColoredTeamName(self.owner.killindicator_teamchange), " in ", ftos(self.cnt), " seconds")); } @@ -1286,19 +1302,25 @@ void KillIndicator_Think() } } -void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto +void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 = spec { float killtime; entity e; killtime = autocvar_g_balance_kill_delay; - if(g_race_qualifying) + if(g_race_qualifying || g_cts) killtime = 0; self.killindicator_teamchange = targetteam; - if(!self.killindicator) + if(!self.killindicator) { + if(self.modelindex && self.deadflag == DEAD_NO) + { + killtime = max(killtime, self.clientkill_nexttime - time); + self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam; + } + if(killtime <= 0 || !self.modelindex || self.deadflag != DEAD_NO) { ClientKill_Now(); @@ -1334,10 +1356,14 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto } if(self.killindicator) { - if(targetteam) - self.killindicator.colormod = TeamColor(targetteam); - else + if(targetteam == 0) // just die self.killindicator.colormod = '0 0 0'; + else if(targetteam == -1) // auto + self.killindicator.colormod = '0 1 0'; + else if(targetteam == -2) // spectate + self.killindicator.colormod = '0.5 0.5 0.5'; + else + self.killindicator.colormod = TeamColor(targetteam); } } @@ -1355,20 +1381,15 @@ void ClientKill (void) ClientKill_TeamChange(0); } -void CTS_ClientKill_Think (void) +void CTS_ClientKill (entity e) // silent version of ClientKill { - self = self.owner; // set self to the player to be killed - sprint(self, "^1You were killed in order to prevent cheating!"); - ClientKill_Now(); -} - -void CTS_ClientKill (float t) // silent version of ClientKill -{ - entity e; - e = spawn(); - e.owner = self; - e.think = CTS_ClientKill_Think; - e.nextthink = t; + e.killindicator = spawn(); + e.killindicator.owner = e; + e.killindicator.think = KillIndicator_Think; + e.killindicator.nextthink = time + (e.lip) * 0.05; + e.killindicator.cnt = ceil(autocvar_g_cts_finish_kill_delay); + e.killindicator.health = 1; // this is used to indicate that it should be silent + e.lip = 0; } void DoTeamChange(float destteam) @@ -1527,7 +1548,21 @@ void ClientConnect (void) // dom_player_join_team(self); // identify the right forced team - if(PlayerInIDList(self, autocvar_g_forced_team_red)) + if(autocvar_g_campaign) + { + if(clienttype(self) == CLIENTTYPE_REAL) // only players, not bots + { + switch(autocvar_g_campaign_forceteam) + { + case 1: self.team_forced = COLOR_TEAM1; break; + case 2: self.team_forced = COLOR_TEAM2; break; + case 3: self.team_forced = COLOR_TEAM3; break; + case 4: self.team_forced = COLOR_TEAM4; break; + default: self.team_forced = 0; + } + } + } + else if(PlayerInIDList(self, autocvar_g_forced_team_red)) self.team_forced = COLOR_TEAM1; else if(PlayerInIDList(self, autocvar_g_forced_team_blue)) self.team_forced = COLOR_TEAM2; @@ -2704,7 +2739,7 @@ void PlayerPreThink (void) if(frametime) player_anim(); button_pressed = (self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE); - force_respawn = (g_lms || (g_ca) || autocvar_g_forced_respawn); + force_respawn = (g_lms || g_ca || g_cts || autocvar_g_forced_respawn); if (self.deadflag == DEAD_DYING) { if(force_respawn)