Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions addons/sourcemod/scripting/TeamManager.sp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,9 @@ public Action OnJoinTeamCommand(int client, const char[] command, int argc)

if(g_bZombieReloaded)
{
if(!g_bZombieSpawned && NewTeam == CS_TEAM_T || NewTeam == CS_TEAM_NONE)
// Auto-assign (NONE) always goes to CT; joining T before the mother
// zombie has spawned is redirected to CT as well.
if((!g_bZombieSpawned && NewTeam == CS_TEAM_T) || NewTeam == CS_TEAM_NONE)
NewTeam = CS_TEAM_CT;

else if(g_bZombieSpawned && NewTeam == CS_TEAM_SPECTATOR)
Expand All @@ -318,8 +320,9 @@ public Action OnJoinTeamCommand(int client, const char[] command, int argc)
if(NewTeam == CurrentTeam)
return Plugin_Handled;

// Prevent players from changing team if they are already in a team (CT or T)
if(!g_cvAliveTeamChange.BoolValue && IsPlayerAlive(client) && NewTeam >= 0 && (CurrentTeam == CS_TEAM_T || CurrentTeam == CS_TEAM_CT))
// Prevent alive players from switching between CT and T when disallowed.
// NewTeam is already validated to be within [CS_TEAM_NONE, CS_TEAM_CT] above.
Comment on lines +323 to +324
if(!g_cvAliveTeamChange.BoolValue && IsPlayerAlive(client) && (CurrentTeam == CS_TEAM_T || CurrentTeam == CS_TEAM_CT))
return Plugin_Handled;

ChangeClientTeam(client, NewTeam);
Expand Down