From: Freddy Date: Wed, 27 Sep 2017 20:26:26 +0000 (+0200) Subject: Kick teamkiller mutator: use lower limit of teamkills instead of mintime X-Git-Tag: xonotic-v0.8.5~2425^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5e9de0c3ad5a794fd5a79c1733f6be5412559baf;p=xonotic%2Fxonotic-data.pk3dir.git Kick teamkiller mutator: use lower limit of teamkills instead of mintime --- diff --git a/mutators.cfg b/mutators.cfg index 6e581fdbc..1538c684f 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -476,5 +476,5 @@ set g_dynamic_handicap_max 0 "The maximum value of the handicap." // =============== // kick teamkiller // =============== -set g_kick_teamkiller_rate 0 "Limit for teamkills per minute before the client gets dropped." -set g_kick_teamkiller_mintime 2 "Minimum playtime in minutes that is used for teamkill rate calculation" +set g_kick_teamkiller_rate 0 "Limit for teamkills per minute before the client gets dropped. 0 means that the teamkillers don't get kicked automatically" +set g_kick_teamkiller_lower_limit 5 "Minimum number of teamkills before the teamkill rate is considered" diff --git a/qcsrc/common/mutators/mutator/kick_teamkiller/sv_kick_teamkiller.qc b/qcsrc/common/mutators/mutator/kick_teamkiller/sv_kick_teamkiller.qc index 1772bcc63..5b5f03833 100644 --- a/qcsrc/common/mutators/mutator/kick_teamkiller/sv_kick_teamkiller.qc +++ b/qcsrc/common/mutators/mutator/kick_teamkiller/sv_kick_teamkiller.qc @@ -1,6 +1,6 @@ float autocvar_g_kick_teamkiller_rate; -float autocvar_g_kick_teamkiller_mintime; +float autocvar_g_kick_teamkiller_lower_limit; REGISTER_MUTATOR(kick_teamkiller, (autocvar_g_kick_teamkiller_rate > 0)); @@ -21,10 +21,11 @@ MUTATOR_HOOKFUNCTION(kick_teamkiller, PlayerDies) } int teamkills = PlayerScore_Get(attacker, SP_TEAMKILLS); - // don't use the players actual playtime if they just started playing - // to avoid kicking players who only teamkilled by mistake just after joining - float playtime_minutes = max((time - attacker.alivetime)/60.0, autocvar_g_kick_teamkiller_mintime); - if (teamkills >= autocvar_g_kick_teamkiller_rate*playtime_minutes) + // use the players actual playtime + float playtime = time - attacker.alivetime; + // rate is in teamkills/minutes, playtime in seconds + if (teamkills >= autocvar_g_kick_teamkiller_lower_limit && + teamkills >= autocvar_g_kick_teamkiller_rate*playtime/60.0) { Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK_TEAMKILL, attacker.netname); dropclient(attacker);