NB! It seems this console command is not compatible with CS2.
Command Profile

MAXPLAYERS

CS:GO

This command sets the maximum amount of players that can connect to your server (i.e. the player cap).

Syntax
maxplayers [Amount]

Description

This command sets the maximum amount of players that can connect to your server (i.e. the player cap).

How To Use maxplayers

  1. Enable the developer console in Counter-Strike settings.
  2. Open the console with the tilde key (~).
  3. Enter maxplayers [Amount], replacing bracketed arguments with the value you want, then press Enter.

This legacy command is not currently listed as compatible with Counter-Strike 2.

Syntax And Arguments

maxplayers [Amount]
Amount The maximum amount of players that can connect. 10 would mean only 10 can connect at any given time.