autoexec.cfg is automatically executed once when the server starts before a map loads
server.cfg is automatically executed each time a map loads, including map changes
There's also map specific configs that are named after the map. These are executed last.
You usually want to put all of your server configuration in server.cfg
so that any setting changes, such as from a mapname.cfg
file, are reset when the map changes. The autoexec.cfg
is used for anything that should be done before a map loads, such as sv_pure
settings.
Also, you can change which file is executed on map change using the servercfgfile
cvar. This is handy if you want to have different modes on a server, or run multiple servers from the same installation.
At least in Portal, there is no air resistance, though whether this is due to the engine or the game design itself, I'm not sure.
It's easy to test -- simply place two portals on the floor, and fall directly down onto one. If done correctly, Chell will continuously fall through the one portal, exit through the second, reach the apex, fall back through the portal, and repeat ad infinitum. No matter how many passes through the portal, each time she will rise to the same level -- i.e. no air resistance.
Likewise, it is very easy to test for a terminal velocity (given that we know there is no air resistance) -- again, in Portal, play through the last level until just before GlaD0s. There is a large wire bridge very high above a room (it is the one with 12+ sentry robots placed at various nooks and crannies around the room). Shooting two portals into the floor (as described above) and jumping into them will show that though velocity is maintained through the portals, there is not nearly enough momentum to reach the bridge again -- hence, the previously established terminal velocity.
Since a mod exists to add the portal gun to Team Fortress 2... (http://www.3-pg.com/forums/index.php?showtopic=5292) it stands to reason that either a) these factors as they relate to gravity calculations are equivalent between the two source games, or b) you can test for yourself (via custom maps, if necessary) by using the portal gun in team fortress 2 (which I know is the game that garnered these questions in the first place)
Edit: On second thought, I'm not sure the portal gun from the mod uses the same code as the one from Portal, so test that with a grain of salt.
Best Answer
I am not sure, if all Source engine games do it this way, but in Team Fortress 2 I use the autoexec.cfg file together with a few additional files. >Reference to a relevant Portal 2 question
Of course, you can also use the syntax described below directly in the console as well - it just won't be persistent that way.
In the games config directory (e.g. Team Fortress 2/tf/cfg) you can find (or create if it isn't there) a file called autoexec.cfg. You should not change the existing config.cfg, but you can have a look into that file for further reference.
In this autoexec.cfg file we can add commands that will be automatically called on launch of the game. You should be able to add a line for your keybind in here. The syntax may look like the following:
This will toggle the r_drawviewmodel command each time you press the "h"-Button. The incrementvar keyword will count upwards from 0 until it reaches 1 by increments of 1 - that's how that works. It works the same on on the "j"-key with cl_drawhud. If you want to do both at the same time, you can use a semicolon to bind multiple command to one key:
The last line is sometimes needed, sometimes not - it can be frickly and different from game to game in my experience.
In certain games sv_cheats might need to be set to 1 for this to work (I just encountered this problem in CS:GO).
You may also want to make sure to save the file in UTF-8 encoding, if it is not working. When using the Windows Notepad, there is a dropdown menu in the save file interface that reads ANSI by default.