limit the amount of kills allowed per time. This code is already rejected, fixing...
authorFruitieX <fruitiex@gmail.com>
Sat, 11 Dec 2010 19:33:42 +0000 (21:33 +0200)
committerFruitieX <fruitiex@gmail.com>
Sat, 11 Dec 2010 19:33:42 +0000 (21:33 +0200)
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh

index a19aba9..fbe9874 100644 (file)
@@ -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
index d46cca6..5338a10 100644 (file)
@@ -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