From: Mario Date: Wed, 8 Feb 2017 17:26:04 +0000 (+1000) Subject: Add an argument to spectate command, to allow spectating specific players X-Git-Tag: xonotic-v0.8.2~238 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d83422d76f1040425615f91f8176c0a5519017a8;p=xonotic%2Fxonotic-data.pk3dir.git Add an argument to spectate command, to allow spectating specific players --- diff --git a/commands.cfg b/commands.cfg index a8de9b95c..93b68f901 100644 --- a/commands.cfg +++ b/commands.cfg @@ -172,7 +172,7 @@ alias team_pink "cmd selectteam pink; cmd join" alias team_yellow "cmd selectteam yellow; cmd join" alias team_auto "cmd selectteam auto; cmd join" -alias spec "spectate" +alias spec "spectate ${* ?}" // mutator aliases alias sandbox "cmd g_sandbox ${* ?}" diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 1fa600e65..a4145abef 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -473,6 +473,17 @@ void ClientCommand_spectate(entity caller, float request) { if (!intermission_running && IS_CLIENT(caller)) { + if((IS_SPEC(caller) || IS_OBSERVER(caller)) && argv(1) != "") + { + entity client = GetFilteredEntity(argv(1)); + int spec_accepted = VerifyClientEntity(client, false, false); + if(spec_accepted > 0 && IS_PLAYER(client)) + { + if(Spectate(caller, client)) + return; // fall back to regular handling + } + } + int mutator_returnvalue = MUTATOR_CALLHOOK(ClientCommand_Spectate, caller); if (mutator_returnvalue == MUT_SPECCMD_RETURN) return; @@ -487,8 +498,8 @@ void ClientCommand_spectate(entity caller, float request) default: case CMD_REQUEST_USAGE: { - sprint(caller, "\nUsage:^3 cmd spectate\n"); - sprint(caller, " No arguments required.\n"); + sprint(caller, "\nUsage:^3 cmd spectate \n"); + sprint(caller, " Where 'client' can be the player to spectate.\n"); return; } }