Index: src/game/g_local.h =================================================================== --- src/game/g_local.h (revision 1054) +++ src/game/g_local.h (working copy) @@ -350,6 +350,9 @@ qboolean vote; qboolean teamVote; + int demerits; + int messageTime; + vec3_t lastDeathLocation; char guid[ 33 ]; char ip[ 16 ]; @@ -1170,6 +1173,9 @@ extern vmCvar_t g_initialMapRotation; extern vmCvar_t g_chatTeamPrefix; +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 1054) +++ src/game/g_main.c (working copy) @@ -119,6 +119,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; @@ -227,6 +230,9 @@ { &g_chatTeamPrefix, "g_chatTeamPrefix", "0", CVAR_ARCHIVE }, + { &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 1054) +++ src/game/g_cmds.c (working copy) @@ -2773,6 +2773,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 }, @@ -2874,6 +2899,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 == PTE_NONE ) {