2 float autocvar_g_kick_teamkiller_rate;
3 float autocvar_g_kick_teamkiller_mintime;
5 REGISTER_MUTATOR(kick_teamkiller, (autocvar_g_kick_teamkiller_rate > 0));
7 MUTATOR_HOOKFUNCTION(kick_teamkiller, PlayerDies)
17 entity attacker = M_ARGV(1, entity);
18 if (!IS_REAL_CLIENT(attacker))
23 int teamkills = PlayerScore_Get(attacker, SP_TEAMKILLS);
24 // don't use the players actual playtime if they just started playing
25 // to avoid kicking players who only teamkilled by mistake just after joining
26 float playtime_minutes = max((time - attacker.alivetime)/60.0, autocvar_g_kick_teamkiller_mintime);
27 if (teamkills >= autocvar_g_kick_teamkiller_rate*playtime_minutes)
29 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK_TEAMKILL, attacker.netname);