From a6da4358de06937b095dcafd79050e4ea937844a Mon Sep 17 00:00:00 2001 From: rtldg Date: Wed, 2 Nov 2022 23:08:44 +0000 Subject: [PATCH] tf2: only check for 'jointeam spectate' so we don't break the class menu popup --- addons/sourcemod/scripting/shavit-misc.sp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/addons/sourcemod/scripting/shavit-misc.sp b/addons/sourcemod/scripting/shavit-misc.sp index ee8bf412..4dd6e23c 100644 --- a/addons/sourcemod/scripting/shavit-misc.sp +++ b/addons/sourcemod/scripting/shavit-misc.sp @@ -863,8 +863,19 @@ public Action Command_Jointeam(int client, const char[] command, int args) return Plugin_Continue; } - char arg1[8]; - GetCmdArg(1, arg1, 8); + char arg1[16]; + GetCmdArg(1, arg1, sizeof(arg1)); + + if (gEV_Type == Engine_TF2) + { + if (StrEqual(arg1, "spectate", false) || StrEqual(arg1, "spectator", false)) + { + Command_Spec(client, 0); + return Plugin_Stop; + } + + return Plugin_Continue; + } int iTeam = StringToInt(arg1); int iHumanTeam = GetHumanTeam(); @@ -912,11 +923,7 @@ void CleanSwitchTeam(int client, int team) event.Cancel(); } - if(gEV_Type == Engine_TF2) - { - TF2_ChangeClientTeam(client, view_as(team)); - } - else if(team != 1) + if (gEV_Type != Engine_TF2 && team != 1) { CS_SwitchTeam(client, team); }