Tweezer's Half-Life Health Club
Tweezer's Half-Life Health Club™

How To Use Console Commands

CDNOW
Previous page Next Page
Prev Next
On This Page
presents...
A series of tutorials covering the usage of Half-Life's console: a command line interface that can be used to control game play, explore new maps, cheat, and administer a server.
Visit the rest of . Click on the links below...
Other Resources
Command Center
has a complete list of console commands and control variables (cvars).

I.Am/Half-Life
Their section on cheat codes is very good.

Planet Half-Life FAQ
Dated and semi-literate, but with some good info.
TweezerTip™:
Where to Get Half-Life
Half-Life isn't free; you need to buy it. Internet play requires a CD Key number, which only comes with a Half-Life CD. You can't really share CD Keys because they are authenticated before you begin an internet game.


For "deathmatch" play you need either the Half-Life: Game of the Year Edition (now bundled with the Opposing Force expansion and sold as the Half-Life: Adrenaline Pack), or the new Half-Life Counter-Strike release (below).


If you are serious, you'll want both. You can save quite a bit of money by getting the complete set, newly bundled as the Half-Life Platinum Edition.


For more information see .
In Association with Amazon.com
Donations help support this site.

The Half-Life Command Console

Many useful and important things can be done from the Half-Life command console, a command-line interface for the Half-Life program. In this section presents a handy summary of how to use the most common and vital console commands.

Using the Command Console

If you have not used the command console before, or if it doesn't seem to work, see the Getting Started section for basic tips.

Rcon: A Remote Server Console

The console works great for the machine you're playing on, but what if you operate a dedicated server: a Half-Life server on a completely separate machine. Using the rcon command, you can use your local console as a remote server console.... [More]

How To Use Cheats

No, does not advocate using cheats to gain an advantage during a game. But some cheat codes can be very useful for exploring new maps on your own.... [More]

Common Console Commands

Here is a summary of the most common and useful (at least for me) console commands. Indicated in parentheses is whether is a server or a client command.

changelevel mapname  (server)
Switch to a new map on the server. Scores are reset, but everybody remains connected. This is the best way to change maps in a multiplayer game.
mp_timelimit 1 (server)
Change to the next map in your mapcycle. Use this when you're tired of a map, or it's too big or too small for whoever is playing. This bears a little explanation. mp_timelimit is the server parameter that controls how long a given map will be played before the server closes it and loads the next map in the mapcycle file. It is usually set in the valve/server.cfg configuration file For example, my server runs with mp_timelimit set to 20 (minutes). Setting it 0 means "no time limit".
So when you set mp_timelimit 1 you are saying "change maps after 1 minute", which usually means "right now". Typically you'll be doing this using rcon (see below). Oh yes, and since the server re-reads the server.cfg file each time it loads a map, mp_timelimit will then get reset to its normal value.
map mapname (server or singleplayer)
Begins a new game using the mapname map. If used on the server this will drop everyone's connection, typically a bad idea. Use changelevel instead.
model modelname (client)
Change your player model to modelname.
name playername (client)
Change your player name to playername.
status (client)
Best way to find out name of current map.  Lists detailed info for each player.
users (server)
Print a short list of current players.
sv_timeout seconds (server)
Controls how long before the server disconnects a client that has stopped responding. The default is only 65 seconds. During testing I often suspend my client while uploading a file, editing a configuration etc. It's inconvenient to lose my server connection at these times, so usually I temporarily increase sv_timeout to some large value.
sv_gravity num (server)
Default gravity is 800.  Set to 30 for excellent low-grav experience.  Great for the "killbox" map.
mapcyclefile filename (server)
Set name of file read by server to determine cycle of maps.  Set to "0" to use default mapcycle.txt. You can use this to switch to an alternate mapcycle file.
r_drawviewmodel 0 (client)
Make your weapon disappear! Normally you see your own weapon in front of you when you play. Setting r_drawviewmodel to "0" makes it disappear. Setting to "1" will bring it back. Some players find it easier to aim without the distraction of a bobbing barrel that points to one side. This is also handy for making screen shots.
crosshair 0 (client)
Make your crosshairs disappear from the screen. Bring them back with crosshair 1. I use this sometimes when making screen shots.
rcon_password password (client)
Enter password for rcon'ing the server (see below).
rcon_port portnumber (client)
Must be used when port is other than 27015 (see below).
mp_fraglimit num (server)
When playing deathmatch, the map will change whenever any player reaches num kills (frags).  This is normally set in the server config file valve/server.cfg.  Since the server re-reads that file when changing maps, this value will be reset after each map change.  So if you really want to change this value for an entire match, it's better to edit the server config file. See also mp_timelimit.

Rcon: A Remote Server Console

The console works great for the machine you're playing on, but what if you operate a dedicated server: a Half-Life server on a completely separate machine. Using the rcon command, you can use your local console as a remote server console. That means you enter commands into your local console, but they are relayed to the remote server's command console.

This remote console capability is called "rcon".  To rcon the server from a client, you first need to establish a connection and authorization. Bring down the client console by typing "~" and enter the commands:

rcon_password password
rcon_port portnumber (your server port, e.g. 27015)

Once you've done this you can issue server commands by prefixing each command with "rcon", e.g.:

rcon users
rcon mp_timelimit 1
rcon sv_timeout 300

The server password is set by the server administrator in the valve/server.cfg file. The rcon_password command tells your client which password to use when communicating with the server's console.

Network software in general uses numbered "ports" for clients/server communications. Half-Life servers listen on port 27015 by default, though server administrators often change the port for various reasons (my server uses 27016). The rcon_port command tells your client which port to use for communication with the server. It may not be necessary if you use 27015.

How to Use Cheats

does not advocate using cheats to gain any advantage during a game. But some cheat codes can be very useful for exploring new maps on your own. That is the main focus of this section.

Enabling Cheats

One can't just start typing in cheat codes. Cheating must first be expressly enabled either via the command line switch "-sv_cheats 1" (see Getting Started for how to use command line switches), or with the "sv_cheats 1" console command.

Some cheat codes will only work in singleplayer.

Exploring Maps Using "noclip" and "god"

The most important modes for exploring a map are called noclip and god.  The first allows you to fly and move through walls, and the second makes you invulnerable.  But even when cheats are enabled on the server, you can't enable these two modes on the client -- they only work in singleplayer mode. 

In order to explore a map with noclip and god, therefore, one must start a singleplayer Half-Life game with cheats enabled and the desired map selected. One simple way to do this is with command-line switches. For example:

hl.exe +map cabrito -sv_cheats 1 -console

Then, when your game starts, bring down the console (by typing "~") and enter the commands:

noclip
god

The program should confirm that each mode has been turned on.  If you do not see "noclip ON" and "godmode ON", then something is wrong.  These commands are toggles that turn the modes on and off.

You don't have to start the game with special command line switches. A good alternative is to start the Half-Life program and then choose "Console" from the main menu (if it isn't there, then you didn't enable the console with -console). You can now start a game from the console. Enter the commands:

sv_cheats 1
map cabrito
noclip
god

If you don't see a confirmation ("noclip ON") that the modes have been activated then something is wrong.

Now try moving. You will see that walls and surfaces have no effect on your movement.

Other Cheat Codes

There are two other useful console commands that work when cheats are enabled:

  • impulse 101 -- Gives you the HEV suit, all weapons and a bunch of ammo.  You can repeat this command for more ammo until you're full.
  • impulse 76 -- Known as "Grunt-O-Matic", this one spawns a grunt to fight with on any map. It won't work unless you first set developer 1, and mp_allowmonsters 1, then restart a game using map.

Getting Started

Enabling the Console

Unless you start Half-Life with the "-console" switch in your command line, you won't be able to use the console at all. If you know your console works, then skip to the next subsection.

Most players start Half-Life from a Windows alias, either a shortcut on the desktop or in the Start Menu. If it's on the desktop, right-click the icon and click "Properties", then click the "Shortcut" tab. In the "Target" field, make sure that the "-console" switch is present. For example, my Target field looks like this:

"D:\Program Files\SIERRA\Half-Life\hl.exe" -console -full

Note the quote marks around the path to the Half-Life program.

If your Half-Life alias is in the Start Menu, use the Start > Settings > Taskbar command, then click the "Start Menu" tab, and find the Half-Life alias. Right-click it and proceed as above.

Using the Console

With a Half-Life game running, type "~" (tilda) or "`" (accent-grave) [IBM-style US keyboards have these on the same key in the upper left]. The console should descend to cover the top half of your screen. Now you can enter console commands. To return to the game, type "~" or "`" or Escape again.

Members: Login

Not yet registered?

Click here

Donations help support this site.
TweezerTip™: Enable the Console
Unless you start Half-Life with the "-console" command line switch, you won't be able to use the command console at all. Add "-console" to the Windows alias you use to start Half-Life. For more info see Getting Started.
TweezerTip™: Use Command History
The command console supports a simple command history mechanism. Use the up and down arrow keys to scroll through the command history. This is handy for redoing commands. No in-line editing, however.
TweezerTip™: Changing Server Maps
The most common use of rcon at is to make the server change maps. Use the changelevel command when you are exploring or testing maps or when you want to skip to a favorite map during a game.
changelevel cabrito
will change to the map "cabrito".

When you want to skip to the next map in your mapcycle, it's easier to use
mp_timelimit 1
This will make the server think the timelimit for the current map has expired and it will go on to the next one.
TweezerTip™:
Paint Shop Pro
Jasc Paint Shop Pro 7

Jasc Paint Shop Pro 7 is the latest version of this hugely popular image editing utility. This is what uses and recommends for creating personal logos and editing crosshairs.

For more information see .
 
Updated Thursday July 04, 2002 06:30:53 PDT
Site email to theTweeze@chipchapin.com