Index: src/game/g_local.h =================================================================== --- src/game/g_local.h (revision 1102) +++ src/game/g_local.h (working copy) @@ -312,6 +312,9 @@ qboolean vote; qboolean teamVote; + int demerits; + int messageTime; + vec3_t lastDeathLocation; char guid[ 33 ]; char ip[ 40 ]; @@ -1130,6 +1133,9 @@ extern vmCvar_t g_debugVoices; extern vmCvar_t g_voiceChats; +extern vmCvar_t g_floodMaxDemerits; +extern vmCvar_t g_floodMinTime; + extern vmCvar_t g_shove; extern vmCvar_t g_mapConfigs; Index: src/game/g_main.c =================================================================== --- src/game/g_main.c (revision 1102) +++ src/game/g_main.c (working copy) @@ -121,6 +121,9 @@ vmCvar_t g_mapConfigs; vmCvar_t g_chatTeamPrefix; +vmCvar_t g_floodMaxDemerits; +vmCvar_t g_floodMinTime; + vmCvar_t g_layouts; vmCvar_t g_layoutAuto; @@ -230,6 +233,9 @@ { &g_chatTeamPrefix, "g_chatTeamPrefix", "0", CVAR_ARCHIVE, 0, qfalse }, + { &g_floodMaxDemerits, "g_floodMaxDemerits", "0", CVAR_ARCHIVE, 0, qfalse }, + { &g_floodMinTime, "g_floodMinTime", "0", CVAR_ARCHIVE, 0, qfalse }, + { &g_markDeconstruct, "g_markDeconstruct", "1", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qfalse }, { &g_debugMapRotation, "g_debugMapRotation", "0", 0, 0, qfalse }, Index: src/game/g_cmds.c =================================================================== --- src/game/g_cmds.c (revision 1102) +++ src/game/g_cmds.c (working copy) @@ -2888,6 +2888,31 @@ } } +/* +================== +G_FloodLimited + +Determine whether a user is flood limited, and adjust their flood demerits +================== +*/ +qboolean G_FloodLimited( gentity_t *ent ) +{ + int deltatime = level.time - ent->client->pers.messageTime; + + if( !g_floodMaxDemerits.integer ) + return qfalse; + + if( G_admin_permission( ent, ADMF_NOCENSORFLOOD ) ) + return qfalse; + + ent->client->pers.demerits += g_floodMinTime.integer - deltatime; + if( ent->client->pers.demerits < 0 ) + ent->client->pers.demerits = 0; + + ent->client->pers.messageTime = level.time; + return ( ent->client->pers.demerits > g_floodMaxDemerits ); +} + commands_t cmds[ ] = { // normal commands { "team", 0, Cmd_Team_f }, @@ -2992,6 +3017,9 @@ if( cmds[ i ].cmdFlags & CMD_MESSAGE && ent->client->pers.muted ) return; + if( cmds[ i ].cmdFlags & CMD_MESSAGE && G_FloodLimited( ent ) ) + return; + if( cmds[ i ].cmdFlags & CMD_TEAM && ent->client->pers.teamSelection == TEAM_NONE ) {