From c59fcef6877f5f8c9598fe387c10399e93dde18b Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Thu, 24 Nov 2022 01:14:31 +1000 Subject: [PATCH] Block spectators from changing their ready status This is consistent with the existing behaviour of setting .ready to false when a player switches to spectating. Also reduces indenting and removes a condition that's no longer needed since sv_ready_restart was removed. --- qcsrc/server/command/cmd.qc | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index e2d71597f..50b71957b 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -374,27 +374,22 @@ void ClientCommand_ready(entity caller, int request) case CMD_REQUEST_COMMAND: { if (IS_CLIENT(caller) && caller.last_ready < time - 3) + if (warmup_stage || g_race_qualifying == 2) + if (IS_PLAYER(caller) || INGAME_JOINED(caller)) { - if (warmup_stage || g_race_qualifying == 2) + if (caller.ready) // toggle { - if (time < game_starttime) // game is already restarting - return; - if (caller.ready) // toggle - { - caller.ready = false; - if (IS_PLAYER(caller) || INGAME_JOINED(caller)) - bprint(playername(caller.netname, caller.team, false), "^2 is ^1NOT^2 ready\n"); - } - else - { - caller.ready = true; - if (IS_PLAYER(caller) || INGAME_JOINED(caller)) - bprint(playername(caller.netname, caller.team, false), "^2 is ready\n"); - } - - caller.last_ready = time; - ReadyCount(); + caller.ready = false; + bprint(playername(caller.netname, caller.team, false), "^2 is ^1NOT^2 ready\n"); } + else + { + caller.ready = true; + bprint(playername(caller.netname, caller.team, false), "^2 is ready\n"); + } + + caller.last_ready = time; + ReadyCount(); } return; // never fall through to usage } -- 2.39.2