/*_____________________________________________________________________________________________ Desc: Function used when changing team, this handles Team balance and In Round restriction._____________________________________________________________________________________________*/function ChangeTeam( Player, NewTeam, OldTeam ) if ( NewTeam != OldTeam ) then if ( NewTeam != TEAM_SPEC ) then if ( #player.GetAll() == 2 ) then if ( Team == TEAM_CT && team.NumPlayers( TEAM_CT ) == 1 ) then Player:SendLua( "chat.AddText( Color( 255, 178, 0, 255 ), \'[CS] There are too many Counter-Terrorists.\' )" ) return elseif ( Team == TEAM_T && team.NumPlayers( TEAM_T ) == 1 ) then Player:SendLua( "chat.AddText( Color( 255, 178, 0, 255 ), \'[CS] There are too many Terrorists.\' )" ) return end elseif ( #player.GetAll() > 2 ) then if ( Team != Player:Team() ) then if ( Team == TEAM_CT ) then if ( team.NumPlayers( TEAM_CT ) != team.NumPlayers( TEAM_T ) ) then if ( team.NumPlayers( TEAM_CT ) + 1 > team.NumPlayers( TEAM_T ) then Player:SendLua( "chat.AddText( Color( 255, 178, 0, 255 ), \'[CS] There are too many Counter-Terrorists.\' )" ) return end end elseif ( Team == TEAM_T ) then if ( team.NumPlayers( TEAM_T ) != team.NumPlayers( TEAM_CT ) ) then if ( team.NumPlayers( TEAM_T ) + 1 > team.NumPlayers( TEAM_CT ) then Player:SendLua( "chat.AddText( Color( 255, 178, 0, 255 ), \'[CS] There are too many Terrorists.\' )" ) return end end end else return end end Player:SetTeam( Team ) if ( !GAME_JOINABLE ) then Player:KillSilent() else Player:Spawn() end else Player:SetTeam( Team ) Player:KillSilent() end else Player:SendLua( "chat.AddText( Color( 255, 178, 0, 255 ), \'[CS] You are already in this force.\' )" ) return endend