]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/cmd.qc
Added anti-flood to ready command
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / cmd.qc
index c9ceb31b6dc14cc09d4fe24c4d1a9446ec27cb97..f92e151fec16d87995e0479e4c1dc5970e4e3147 100644 (file)
@@ -366,13 +366,13 @@ void ClientCommand_physics(entity caller, int request, int argc)
        }
 }
 
-void ClientCommand_ready(entity caller, int request)  // todo: anti-spam for toggling readyness
+void ClientCommand_ready(entity caller, int request)
 {
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if (IS_CLIENT(caller))
+                       if (IS_CLIENT(caller) && caller.last_ready < time - 3)
                        {
                                if (warmup_stage || g_race_qualifying == 2)
                                {
@@ -391,6 +391,8 @@ void ClientCommand_ready(entity caller, int request)  // todo: anti-spam for tog
                                                        bprint(playername(caller.netname, caller.team, false), "^2 is ready\n");
                                        }
 
+                                       caller.last_ready = time;
+
                                        // cannot reset the game while a timeout is active!
                                        if (!timeout_status) ReadyCount();
                                }