From: terencehill Date: Mon, 21 Oct 2019 20:57:20 +0000 (+0200) Subject: Make so that 'spectate playerX' does nothing (but showing an error messages) if it... X-Git-Tag: xonotic-v0.8.5~1105^2~16^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8d98dadf4e2ef4ad7b6a1841e91cbef91e41d559;p=xonotic%2Fxonotic-data.pk3dir.git 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" --- 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; }