Half-Life Console Commands and Variables

Category: scripts

Use these console commands and variables to customize Half-Life, TFC, Opposing Force, or most HL Mods, troubleshoot problems with video or sound hardware, optimize performance, or make your own scripts. If you don't know how to use these console commands and variables, please see the Console Tutorial. Many of these variables are boolean, which means that they can be either 1 (on) or 0 (off) and no other values are allowed. In the descriptions for boolean variables, I use "enables" or "disables" to indicate what happens when that variable is set on (1). The opposite is always true (if 1 enables the feature, 0 disables it, and vice-versa). Variables that can accept any number as a value have descriptions that begin with "sets the . . . " 

Be sure to check out the other categories, especially the tweaks!. The flags listed at the end of the descriptions of some variables have the following meanings: 

  • a - attribute variable, changes to these variables will be automatically saved to Half-Life/valve/config.cfg (or Half-Life/tfc/config.cfg for TFC). Variables without this flag will return to the default value listed unless set by Half-Life/valve/autoexec.cfg (or Half-Life/tfc/autoexec.cfg for TFC).
  • i - info variable, the values of these variables are displayed in response to the info command. 
  • sv - server info variable, the values of these variables are displayed in response to the serverinfo command. 
  • tfc - team fortress classic variables, these variables apply to TFC mode only (hl.exe -game tfc). 
All · Audio · Cheats · Controls · DemoUtils · Developer · Help · Joystick · Misc · Mouse · Net · Prefs · Scripting · TFC · Tweaks · Unknown · Video
Command
or
Variable
Name
Arguments
or
Default
Description
alias <name> "cmd1; cmd2" define an alias to a command or commands, i.e. alias jumpduck "+moveup; +movedown; wait; -moveup; -movedown"
bind <key> <"cmd1; cmd2"> make activate one or more command(s) or variable settings, enclosed in quotes and separated by semicolons. Binding a key to any +command also automatically binds the release of that key to the -command (see alias)
cancelselect   cancel selection (i.e. what ESCAPE usually does)
developer 0 enable special developer debug console messages and allow 'echo' to print to the game screen, see console help for details
echo "text" print a message to the console. To print to screen: 'developer 1; echo "text"; developer 0'
exec <filename> execute a script file of console commands, often have .cfg or .rc extension, though not required. script files can include any console commands and variable settings, see console help for details
menuselect <X> select menu item X (useful after bringing up your class special menu with 'special' or '+attack2' or 'build') [Flags: tfc]
play <filename> play a WAV audio file designated by filename
say "text" echo text to the screen of all players
say_team "text" echo text to the screen of team members only
scr_connectmsg 0 display "msg" in lower left of screen -- use "" for "msg" to clear
scr_connectmsg1 0 display "msg" in lower left of screen -- use "" for "msg" to clear
scr_connectmsg2 0 display "msg" in lower left of screen -- use "" for "msg" to clear
scr_ofsx 0 set screen message x-offset
scr_ofsy 0 set screen message y-offset
scr_ofsz 0 set screen message z-offset
scr_printspeed 8 set screen message print speed
unbind <key> remove binding to key 
unbindall   remove all key bindings
wait   pause for 1 tick in alias or script
All · Audio · Cheats · Controls · DemoUtils · Developer · Help · Joystick · Misc · Mouse · Net · Prefs · Scripting · TFC · Tweaks · Unknown · Video