]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 a19aba97f9e2d5ff7bea5203625e64c04a8d5c12..fbe98741f20ea684e2a638a1368fb4110436023d 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 d46cca686c051fd24b0e14705f29961cbf9067bb..5338a1025efebf01410966a3f2c8e8b6e12a7582 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