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).

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.