From 401e619ddd3894da6b4b029cc7c78a42091f34eb Mon Sep 17 00:00:00 2001 From: Samual Date: Wed, 7 Dec 2011 23:48:32 -0500 Subject: [PATCH] Add commands.cfg file (needs a lot of work of course) and some new features to client commands --- commands.cfg | 11 +++++++++++ qcsrc/server/clientcommands.qc | 5 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 commands.cfg diff --git a/commands.cfg b/commands.cfg new file mode 100644 index 000000000..06b1363a3 --- /dev/null +++ b/commands.cfg @@ -0,0 +1,11 @@ +// ================================================================= +// Master config for managing various command aliases and settings +// ================================================================= + +// common + + + +// cl_cmd (clientcommand) +set sv_clientcommand_antispam_time 1 "Amount of seconds after a command before another command can be called again without being considered spam. (Use -1 for no antispam limit)" +set sv_clientcommand_antispam_count 5 "Amount of commands considered spam before commands are rejected. \ No newline at end of file diff --git a/qcsrc/server/clientcommands.qc b/qcsrc/server/clientcommands.qc index 51d7267ee..4795b41ae 100644 --- a/qcsrc/server/clientcommands.qc +++ b/qcsrc/server/clientcommands.qc @@ -23,11 +23,10 @@ float SV_ParseClientCommand_floodcheck() { if (timeoutStatus != 2) // if the game is not paused... but wait, doesn't that mean it could be dos'd by pausing it? eh? (old code) { - if(time == self.cmd_floodtime) // todo: add buffer time as well, ONLY one second is a short amount of time for someone to be spamming. + if(time <= (self.cmd_floodtime + autocvar_sv_clientcommand_antispam_time)) { self.cmd_floodcount += 1; - if(self.cmd_floodcount > 8) // todo: replace constant 8 with a cvar for the server to control - return FALSE; // too much spam, halt + if(self.cmd_floodcount > autocvar_sv_clientcommand_antispam_count) { return FALSE; } // too much spam, halt } else { -- 2.39.2