From 8d98dadf4e2ef4ad7b6a1841e91cbef91e41d559 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 21 Oct 2019 22:57:20 +0200 Subject: [PATCH] Make so that 'spectate playerX' does nothing (but showing an error messages) if it fails to spectate playerX. It fixes #2328 "'spectate playerX' doesn't work well" --- qcsrc/server/command/cmd.qc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 6928957d6..ad9cab8e7 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -635,15 +635,22 @@ void ClientCommand_spectate(entity caller, int request) { if (!intermission_running && IS_CLIENT(caller)) { - if((IS_SPEC(caller) || IS_OBSERVER(caller)) && argv(1) != "") + if(argv(1) != "") { - entity client = GetFilteredEntity(argv(1)); - int spec_accepted = VerifyClientEntity(client, false, false); - if(spec_accepted > 0 && IS_PLAYER(client)) + if(IS_SPEC(caller) || IS_OBSERVER(caller)) { - if(Spectate(caller, client)) - return; // fall back to regular handling + entity client = GetFilteredEntity(argv(1)); + int spec_accepted = VerifyClientEntity(client, false, false); + if(spec_accepted > 0 && IS_PLAYER(client)) + { + Spectate(caller, client); + } + else + sprint(caller, "can't spectate ", argv(1), "^7\n"); } + else + sprint(caller, "cmd spectate client only works when you are spectator/observer\n"); + return; } int mutator_returnvalue = MUTATOR_CALLHOOK(ClientCommand_Spectate, caller); @@ -660,7 +667,7 @@ void ClientCommand_spectate(entity caller, int request) default: case CMD_REQUEST_USAGE: { - sprint(caller, "\nUsage:^3 cmd spectate \n"); + sprint(caller, "\nUsage:^3 cmd spectate [client]\n"); sprint(caller, " Where 'client' can be the player to spectate.\n"); return; } -- 2.39.2