{
if(autocvar_g_chat_flood_notify_flooder)
{
- sourcemsgstr = strcat(msgstr, "\n^3FLOOD CONTROL: ^7message too long, trimmed\n");
+ sourcemsgstr = strcat(msgstr, "\n^3CHAT FLOOD CONTROL: ^7message too long, trimmed\n");
sourcecmsgstr = "";
}
else
{
if (autocvar_g_chat_flood_notify_flooder)
{
- sprint(source, strcat("^3FLOOD CONTROL: ^7wait ^1", ftos(source.(flood_field) - time), "^3 seconds\n"));
+ sprint(source, strcat("^3CHAT FLOOD CONTROL: ^7wait ^1", ftos(source.(flood_field) - time), "^3 seconds\n"));
ret = 0;
}
else
ATTRIB(Client, specialcommand_pos, int, this.specialcommand_pos);
ATTRIB(Client, hitplotfh, int, this.hitplotfh);
ATTRIB(Client, clientdata, entity, this.clientdata);
- ATTRIB(Client, cmd_floodcount, int, this.cmd_floodcount);
ATTRIB(Client, cmd_floodtime, float, this.cmd_floodtime);
ATTRIB(Client, wasplayer, bool, this.wasplayer);
ATTRIB(Client, weaponorder_byimpulse, string, this.weaponorder_byimpulse);
// Last updated: December 28th, 2011
// =========================================================
-bool SV_ParseClientCommand_floodcheck(entity this)
-{
- entity store = IS_CLIENT(this) ? CS(this) : this; // unfortunately, we need to store these on the client initially
-
- if (!timeout_status) // not while paused
- {
- if (time <= (store.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
- {
- store.cmd_floodcount += 1;
- if (store.cmd_floodcount > autocvar_sv_clientcommand_antispam_count) return false; // too much spam, halt
- }
- else
- {
- store.cmd_floodtime = time;
- store.cmd_floodcount = 1;
- }
- }
- return true; // continue, as we're not flooding yet
-}
-
// =======================
// Command Sub-Functions
case "prespawn": break; // handled by engine in host_cmd.c
case "sentcvar": break; // handled by server in this file
case "spawn": break; // handled by engine in host_cmd.c
+ case "say": case "say_team": case "tell": break; // chat has its own flood control in chat.qc
case "color": case "topcolor": case "bottomcolor": // handled by engine in host_cmd.c
if(!IS_CLIENT(this)) // on connection
{
break;
case "c2s": Net_ClientCommand(this, command); return; // handled by net.qh
+ // on connection, client sends all of these
+ case "name": case "rate": case "rate_burstsize": case "playermodel": case "playerskin": case "clientversion":
+ if(!IS_CLIENT(this)) break;
+ // else fall through to default: flood control
default:
- if (SV_ParseClientCommand_floodcheck(this)) break; // "true": continue, as we're not flooding yet
- else return; // "false": not allowed to continue, halt // print("^1ERROR: ^7ANTISPAM CAUGHT: ", command, ".\n");
+ if (!timeout_status) // not while paused
+ {
+ entity store = IS_CLIENT(this) ? CS(this) : this; // unfortunately, we need to store these on the client initially
+ // this is basically the same as the chat flood control
+ if (time < store.cmd_floodtime)
+ {
+ sprint(this, strcat("^3CMD FLOOD CONTROL: wait ^1", ftos(store.cmd_floodtime - time), "^3 seconds, command was: ", command, "\n"));
+ return; // too much spam, halt
+ }
+ else
+ store.cmd_floodtime = max(time - autocvar_sv_clientcommand_antispam_count * autocvar_sv_clientcommand_antispam_time, store.cmd_floodtime) + autocvar_sv_clientcommand_antispam_time;
+ }
+ break; // continue, as we're not flooding yet
}
/* NOTE: should this be disabled? It can be spammy perhaps, but hopefully it's okay for now */