Choosing who can connect
Fully 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:
Code: Select all
connect "serverip"
Code: Select all
sv_steamgroup yourgroupid
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:
Code: Select all
mm_dedicated_force_servers "yourserverip"
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:
Code: Select all
sv_steamgroup yourgroupid
sv_steamgroup_exclusive 1
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_password
Note: 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:
Code: Select all
sv_password "yourpassword"
Private, through sv_search_key
If you'd like to still use the lobbying system but to only allow certain players to form lobbies that can connect to it, this is the option for you. By setting this command in your server.cfg or autoexec.cfg, you restrict lobby creation to users who use the same command on their client.
Code: Select all
sv_search_key "yourpassword"
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:
Code: Select all
map c3m1_plankcountry
Code: Select all
map c3m1_plankcountry versus
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:
Code: Select all
sv_gametypes "coop,realism,survival,versus,teamversus,scavenge,teamscavenge"