Restricting access and game types played in L4D2

Post Reply
User avatar
Edge100x
Founder
Founder
Posts: 12945
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Restricting access and game types played in L4D2

Post by Edge100x »

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 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"
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:

Code: Select all

sv_steamgroup yourgroupid
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:

Code: Select all

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:

Code: Select all

sv_steamgroup yourgroupid
sv_steamgroup_exclusive 1
However, 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_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"
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 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"
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. His client will then automatically use the server when he triggers the game to start (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:

Code: Select all

map c3m1_plankcountry
To start with a different game type, add that to the end of the line, like this:

Code: Select all

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:

Code: Select all

sv_gametypes "coop,realism,survival,versus,teamversus,scavenge,teamscavenge"
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.
Post Reply