This guide talks about the different ways to set up who can access your L4D2 server and what game types they can play. Please note that it refers to what should
happen; current bugs in the game might prevent the intended behavior.Choosing who can connectFully public and unlocked
This is the default setup. Normally, L4D2 allows any matchmaking lobby to connect to your empty server, and when the lobby connects, the map, game type (coop, versus, realism, etc), and player limit will change to whatever the lobby leader specified (to restrict the game types your server runs, see the second half of this post). It does not matter what map the server was on before or what is listed in the mapcycle.
In this configuration, and all other configurations, clients can also connect manually through their consoles with:
If you'd also like to see your server in the Steam group menu in your game client, set this cvar to a Steam group that you belong to, in your server.cfg or autoexec.cfg file:
You can find your group's ID on the admin profile page in the Steam community.
If your server is empty and you want to connect to it with your own lobby, but you'd prefer not to use sv_search_key (detailed below), you can type this command in your client console (before starting a lobby) to try to force your client to look for your server exclusively:
mm_dedicated_force_servers "yourserverip"Private, through sv_steamgroup_exclusive
If you set these cvars in your server.cfg or autoexec.cfg file, only members of your steamgroup will be able to start up a game in the server, via the in-game menu:
, once a game has been started, public players will be able to join, as well, so the server is not truly private.
Since lobbies can't connect to change its game type, the game will continue to run whatever game type you start it with in your autoexec.cfg, and it will show up under the corresponding menu in your client.Private, through sv_passwordNote: As L4D2 has a bug that prevents server queries from working properly when this method is used, so we recommend against it. The sv_search_key method is the best alternative.
If you password-protect your server, it won't be available to public lobbies, but you still will be able to connect to it manually (through the console) or through your steamgroup. When you connect, the game will ask for a password.
To set up the requirement for a password, put a line like this in your autoexec.cfg or server.cfg:
Since lobbies can't connect to change its game type, the game will continue to run whatever game type you start it with in your autoexec.cfg, and show up under the corresponding menu in your client.Private, through sv_search_key
If you'd like to still use the lobbying system but to only allow certain players to form lobbies and connect to it, this is the option for you. By setting this command in your server.cfg or autoexec.cfg, you restrict it to users who use the same command on their client:
After this is set, the lobby-leader-to-be will need to pull down the developer console in his client and enter the same thing there, before he creates the lobby. He will then be able to connect to the server (assuming it's empty).Choosing the game type
You can choose the initial game type for a server through the map command in your autoexec.cfg. You should already have a line like this there:
To run a different game type, add that to the end of the line, like this:
map c3m1_plankcountry versus
You can also use this, through rcon, to change the map and game type of a server while it is running. However, doing so will also kick everyone from the server (forcing them to reconnect).
The game type you choose with the "map" command will "stick" until a lobby connects that requests a different one. If you'd like to restrict your server to allowing lobbies requesting certain gametypes only, put a command like this in your autoexec.cfg file, before the "map" line:
Include only the game types that you want your server to play, and only lobbies that wish to play one of these types will be allowed to connect.