Xonotic
sv_kick_teamkiller.qc File Reference
+ Include dependency graph for sv_kick_teamkiller.qc:

Go to the source code of this file.

Functions

 MUTATOR_HOOKFUNCTION (kick_teamkiller, PlayerDies)
 
 REGISTER_MUTATOR (kick_teamkiller,(autocvar_g_kick_teamkiller_rate > 0))
 

Variables

float autocvar_g_kick_teamkiller_lower_limit
 
float autocvar_g_kick_teamkiller_rate
 

Function Documentation

◆ MUTATOR_HOOKFUNCTION()

MUTATOR_HOOKFUNCTION ( kick_teamkiller  ,
PlayerDies   
)

Definition at line 8 of file sv_kick_teamkiller.qc.

References autocvar_g_kick_teamkiller_lower_limit, autocvar_g_kick_teamkiller_rate, CS(), dropclient_schedule(), entity(), IS_REAL_CLIENT, M_ARGV, NULL, PlayerScore_Get, teamplay, time, and warmup_stage.

9 {
10  if (!teamplay)
11  {
12  return;
13  }
14  if (warmup_stage)
15  {
16  return;
17  }
18  entity attacker = M_ARGV(1, entity);
19  if (!IS_REAL_CLIENT(attacker))
20  {
21  return;
22  }
23 
24  int teamkills = PlayerScore_Get(attacker, SP_TEAMKILLS);
25  // use the players actual playtime
26  float playtime = time - CS(attacker).startplaytime;
27  // rate is in teamkills/minutes, playtime in seconds
28  if (teamkills >= autocvar_g_kick_teamkiller_lower_limit &&
29  teamkills >= autocvar_g_kick_teamkiller_rate*playtime/60.0)
30  {
31  if (dropclient_schedule(attacker))
32  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK_TEAMKILL, attacker.netname);
33  }
34 }
#define PlayerScore_Get(player, scorefield)
Returns the player's score.
Definition: scores.qh:43
entity() spawn
ClientState CS(Client this)
Definition: state.qh:47
bool warmup_stage
Definition: main.qh:103
bool dropclient_schedule(entity this)
Schedules dropclient for a player and returns true; if dropclient is already scheduled (for that play...
Definition: main.qc:42
#define IS_REAL_CLIENT(v)
Definition: utils.qh:17
#define NULL
Definition: post.qh:17
float autocvar_g_kick_teamkiller_lower_limit
float teamplay
Definition: progsdefs.qc:31
#define M_ARGV(x, type)
Definition: events.qh:17
float time
Definition: csprogsdefs.qc:16
float autocvar_g_kick_teamkiller_rate
+ Here is the call graph for this function:

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( kick_teamkiller  ,
(autocvar_g_kick_teamkiller_rate > 0)   
)

Variable Documentation

◆ autocvar_g_kick_teamkiller_lower_limit

float autocvar_g_kick_teamkiller_lower_limit

Definition at line 4 of file sv_kick_teamkiller.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_kick_teamkiller_rate

float autocvar_g_kick_teamkiller_rate

Definition at line 3 of file sv_kick_teamkiller.qc.

Referenced by MUTATOR_HOOKFUNCTION().