From 71bcd114b2be38a85c56279b851c7ca7cea83520 Mon Sep 17 00:00:00 2001 From: FruitieX Date: Sat, 11 Dec 2010 21:33:42 +0200 Subject: [PATCH] limit the amount of kills allowed per time. This code is already rejected, fixing later when div0 does it the right way for other actions as well --- qcsrc/server/cl_client.qc | 10 +++------- qcsrc/server/defs.qh | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index a19aba97f..fbe98741f 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1304,15 +1304,14 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto if(g_cts) // allow an instant kill in CTS { - if(self.killcnt < 5) // 5 kills in 5 seconds allowed + if(self.selfkilltime < time + 3) // prevent spam { - self.killcnt += 1; + self.selfkilltime = max(time, self.selfkilltime) + 2; ClientKill_Now(); } return; } - - else if(!self.killindicator) + if(!self.killindicator) { if(killtime <= 0 || !self.modelindex || self.deadflag != DEAD_NO) { @@ -2877,9 +2876,6 @@ void PlayerPreThink (void) if(g_nexball) nexball_setstatus(); - if(g_cts) - self.killcnt = max(0, self.killcount - sys_frametime); - self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime); //self.angles_y=self.v_angle_y + 90; // temp diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index d46cca686..5338a1025 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -660,4 +660,4 @@ float serverflags; .float freezetag_beginrevive_time; .float freezetag_revive_progress; -.float killcnt; // keep track of how many times a player has suicided during the previous 5 seconds +.float selfkilltime; // when to allow another selfkill in CTS -- 2.39.2