mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
added spam protection
This commit is contained in:
parent
ae71bff086
commit
83660e0853
|
@ -52,5 +52,6 @@ MACRO_CONFIG_INT(sv_scorelimit, 20, 0, 1000)
|
|||
MACRO_CONFIG_INT(sv_timelimit, 0, 0, 1000)
|
||||
MACRO_CONFIG_STR(sv_gametype, 32, "dm")
|
||||
MACRO_CONFIG_INT(sv_tournament_mode, 0, 0, 1)
|
||||
MACRO_CONFIG_INT(sv_spamprotection, 1, 0, 1)
|
||||
|
||||
MACRO_CONFIG_INT(sv_spectator_slots, 0, 0, 12)
|
||||
|
|
|
@ -317,6 +317,9 @@ public:
|
|||
// the player core for the physics
|
||||
player_core core;
|
||||
|
||||
//
|
||||
int64 last_chat;
|
||||
|
||||
//
|
||||
player();
|
||||
void init();
|
||||
|
|
|
@ -683,6 +683,7 @@ void player::reset()
|
|||
die_tick = 0;
|
||||
die_pos = vec2(0,0);
|
||||
damage_taken = 0;
|
||||
last_chat = 0;
|
||||
player_state = PLAYERSTATE_UNKNOWN;
|
||||
|
||||
mem_zero(&input, sizeof(input));
|
||||
|
@ -2113,8 +2114,17 @@ void mods_message(int msgtype, int client_id)
|
|||
team = players[client_id].team;
|
||||
else
|
||||
team = -1;
|
||||
|
||||
if(config.sv_spamprotection && players[client_id].last_chat+time_freq() > time_get())
|
||||
{
|
||||
// consider this as spam
|
||||
}
|
||||
else
|
||||
{
|
||||
players[client_id].last_chat = time_get();
|
||||
send_chat(client_id, team, msg->message);
|
||||
}
|
||||
}
|
||||
else if (msgtype == NETMSGTYPE_CL_SETTEAM)
|
||||
{
|
||||
NETMSG_CL_SETTEAM *msg = (NETMSG_CL_SETTEAM *)rawmsg;
|
||||
|
|
Loading…
Reference in a new issue