Xonotic
sv_kick_teamkiller.qc
Go to the documentation of this file.
1
#include "
sv_kick_teamkiller.qh
"
2
3
float
autocvar_g_kick_teamkiller_rate
;
4
float
autocvar_g_kick_teamkiller_lower_limit
;
5
6
REGISTER_MUTATOR
(kick_teamkiller, (
autocvar_g_kick_teamkiller_rate
> 0));
7
8
MUTATOR_HOOKFUNCTION
(kick_teamkiller, PlayerDies)
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
}
MUTATOR_HOOKFUNCTION
MUTATOR_HOOKFUNCTION(kick_teamkiller, PlayerDies)
Definition:
sv_kick_teamkiller.qc:8
PlayerScore_Get
#define PlayerScore_Get(player, scorefield)
Returns the player's score.
Definition:
scores.qh:43
entity
entity() spawn
CS
ClientState CS(Client this)
Definition:
state.qh:47
warmup_stage
bool warmup_stage
Definition:
main.qh:103
sv_kick_teamkiller.qh
dropclient_schedule
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
IS_REAL_CLIENT
#define IS_REAL_CLIENT(v)
Definition:
utils.qh:17
REGISTER_MUTATOR
REGISTER_MUTATOR(kick_teamkiller,(autocvar_g_kick_teamkiller_rate > 0))
NULL
#define NULL
Definition:
post.qh:17
autocvar_g_kick_teamkiller_lower_limit
float autocvar_g_kick_teamkiller_lower_limit
Definition:
sv_kick_teamkiller.qc:4
teamplay
float teamplay
Definition:
progsdefs.qc:31
M_ARGV
#define M_ARGV(x, type)
Definition:
events.qh:17
time
float time
Definition:
csprogsdefs.qc:16
autocvar_g_kick_teamkiller_rate
float autocvar_g_kick_teamkiller_rate
Definition:
sv_kick_teamkiller.qc:3
common
mutators
mutator
kick_teamkiller
sv_kick_teamkiller.qc
Generated on Thu Mar 17 2022 17:26:28 for Xonotic by
1.8.13