Console commands

The console is a feature of many games that can be used to change certain elements of a game. In Left 4 Dead and Left 4 Dead 2, it can be activated in the Options menu (go to "Keyboard/Mouse", then Enable the "Allow Developer Console" option) and then displayed by pressing the tilde (~) key in game (you don't need to press "Shift"). Valve features a quick-type feature in their consoles that allow rapid entry of commands.

Note that the key used to access the (blank) console may be different on non-U.S. keyboard layouts; for example, a standard UK keyboard layout uses the " ` " key (left of the "1" key).

You may edit the config file within your game directory directly. The file is located under

 -> left4dead -> cfg -> config.cfg

Just open the file with your favorite text-editor and adjust it to your needs.

Another workaround for non-U.S. keyboard layouts ― Finnish in particular ― is to switch to a U.S. keyboard layout, start the game, opening the console and typing bind "K" "toggleconsole"―then switching back to your own language. If you can't open the console with the change keyboard layout method, write -console in launch options in Left 4 Dead 2 properties (right click on Left 4 Dead 2 in Steam Library -> properties). Adding a console toggle to "K" this way bypasses Steam Cloud overwriting custom settings made, and allows you to add a more suitable console toggle with a familiar keyboard layout. The console key you have made might not work in the lobby or start menu, but it should work in-game.

'sv_cheats'
The 'sv_cheats 1' is a prerequisite command to many of the game-altering commands found in the Left 4 Dead series (including other Valve games, such as Half-Life). In the Left 4 Dead series, by setting sv_cheats to 1, most commands are then recognized by the game. It is with 'sv_cheats 1' that most of the exploits were found by users in the demo during its pre-order era.

Setting 'sv_cheats' to 1 disables the ability to earn achievements. This counts with Grind Achievements, too, which are achievements that are based on your lifetime performance (i.e. killing 5,359 Zombies in Crash Course) and any other Achievement that uses a Counter-based system to acquire (i.e. Collect 10 Boomer Bile Bombs of Dead CEDA Agents) as well, so any Infected killed with cheats enabled will not count towards Zombie Genocidest or any similar achievement. However, when you turn it off, achievements are still disabled. Only restarting the game will allow achievements. Achievements can still be earned through an online game as long as the cheats were never enabled on that server.

Unfortunately, Valve has disabled the ability to enable 'sv_cheats 1' in Left 4 Dead 2's official campaigns. To enable "sv_cheats" in Left 4 Dead 2, one will either load customs maps using the command "map X" with "X" being the name of the map, or use the same map command to load the official maps as if they were custom ones. Achievements are still unobtainable with "sv_cheats 1".

Annotated list of commands
Knowing all the commands isn't quite as good as knowing what they do. The following will describe what each command does and its default value.

Important things to know about your cheat console:
 * Some commands require you to be the game host (such as setting  to 1).
 * It is assumed that you have  set for the commands described in this section.
 * If you turn on cheats then turn them off, many settings are discarded!
 * The console can auto-complete commands; never type more than you need to; just type a few letters and then hit the up/down arrows.
 * Commands can be chained. Example:  will toggle cheats on/off and drops a can of whoop-ass where you are pointing.
 * You can store your commands in a " " file you create in a text editor like "Notepad" (Notepad++ is recommended for this) and put it in . It will get executed when your server runs. You can also execute a particular config file, e.g., " ", by using " " in the console.
 * If you are not sure of the correct spelling of a command, just type the first set of letters that you know and press "Tab." The console will cycle through each command beginning with what you have just typed. Press the "Tab" key multiple times until the desired command is shown.

Noclip
Noclip (makes you fly and go through walls)

sv_noclipspeed # (set the amount of speed for noclip)

+noclip

God mode
God 1

Survivors are completely invincible.

Survivors will not take any damage, and will not be slowed by Special Infected attacks. The only offical way to lose is to leave everyone hanging on a ledge.

Note: If a Survivor has fallen from a ledge, or pinned somewhere out of reach, use the "warp_all_survivors_here" command to save them.

Buddha 1 (similar to God mode in that you cannot die; however, you can recieve damage. However, the "cannot die" effect is only applied if you are the last Survivor alive. If you are, then whenever you take an Incapacitation-worthy hit, your HP will be restored to 9 instantly, thus preventing you from being Incapacitated. However, sometimes one can actually die immediately after receiving damage rather than become Incapacitated or have their HP restored.)

Stopping the apocalypse
Using this code will stop the Director from spawning any Infected. You can explore the level without any fight.

director_stop

To start the Director again, type in:

director_start

Note: This code will not kill Special Infected that has already spawned. Note: Infected in map design will still spawn, including the bride Witch in The Riverbank, Witches in The Sugarmill, the Tank in train car in The Docks, as well as every Tank during the finales.

The Witch lets you come closer... a bit
z_witch_anger_rate 0.2 Setting it lower allows you to go near her without startling her quickly.

Prop Spawner
cl_precacheinfo modelprecache gives you an advanced list of items. After you choose what you want, you need to place it after prop_dynamic_create (non-movable) prop_physics_create (moveable)

Who would you like to use?
Use this code to switch between Survivors

sb_takecontrol (Name)

Put the name of a Survivor bot behind this code to switch to that Survivor; for example, "sb_takecontrol zoey" will let you control Zoey.

Spawn Infected
These commands can be used to drop (spawn) in additional enemies.

z_spawn tank z_spawn witch z_spawn boomer z_spawn smoker z_spawn hunter z_spawn common, z_spawn horde,z_spawn (Unknown) (spawns one infected) z_spawn mob (NOTE: these "Mobs" last a LOT longer than the usual horde)

To remove (unspawn) Special, use the  command: kick tank kick boomer kick smoker kick hunter

This command does not work on the Witch or Common Infected. To bind multiple kicks to a key, it is safer to use the  command in between the kick commands.

i.e.

bind "K" "kick tank;wait;kick boomer;wait;kick smoker;wait;kick hunter"

Spawning more than one of the same Special Infected causes their names to go into a numbered list starting with no number. Example Hunter (1)Hunter (2)Hunter (3)Hunter

So when you try to kick a Hunter and it doesn't work, then there maybe be more than one Hunter on the map.

Note: For some reason, if you throw a Bile Bomb at a bunch of Forced Uncommons, they will start pushing rather than hitting each other, like when you bash one with your weapon. Also, if you throw a Bile Bomb on Jimmy Gibbs Jr., the Purple Aura remains on him even after the effects have faded, thus lighting him up through walls.

Guns 'R' Us
Press: " in the console, and then the item names will appear.

give smg_mp5

give sniper_awp

give sniper_scout

give pumpshotgun

give sniper_military

give rifle_ak47

give shotgun_chrome

give rifle_sg552

Custom Weapons
For This you Will need Sourcemod & Metamod to have this weapons.

give thrower

give fubar

give mace

give b_foamfinger

give riotshield

give small_knife

DEMO Weapons
For this you just type(only works in demo) in the console the next command to have an extra weapon:

ent_create weapon grenade_launcher

give autoshotgun give hunting_rifle give health give rifle give pistol give smg give shotgun give pain_pills give first_aid_kit give pipe_bomb give molotov give vomitjar give propane_tank give gascan

Drops
Need to drop a pipe bomb or molotov instantly, damn the consequences? This will throw an armed pipe bomb or molotov at your feet. You might want to be running when you try these.

fire // will drop a Molotov in the center of the character lighting you on fire boom // will drop a Pipe Bomb in the center of the character ready to explode

How many zombies would you like?
By default, the game limits how many zombies are drawn at any given time. You can bypass this limit to get truly outrageous numbers of zombies and also make you crash.

z_common_limit 30

Now, how can we get the director to give us more mobs of zombies at random times? z_mob_spawn_min_interval_expert 90 z_mob_spawn_max_interval_expert 180 z_mob_spawn_min_size 10 z_mob_spawn_max_size 30

Still not hard enough... perhaps you need a mega-mob! z_mega_mob_spawn_min_interval 420 z_mega_mob_spawn_max_interval 900 z_mega_mob_size 50

All good and fine, but what about those spaced-out zombies that are just standing still, waiting for you to shoot them? Would it not be more awesome if they were always moving and instantly targeted you?

z_must_wander 0 z_acquire_far_range 2500 z_acquire_far_time 5 z_acquire_near_range 200 z_acquire_near_time 0.5

Okay, if you got this far, you're going to need more boss zombies. This controls time in seconds between boss spawns and the max number of bosses that can be spawned at any given time:

z_special_spawn_interval 45 z_exploding_limit 1 z_gas_limit 1 z_hunter_limit 1 z_minion_limit 3 // This limits the number of 1 type of Special Infected allowed at one time. In certain cases, you would get three Hunters; this will make sure you do not get four, so in                   places like Versus, you will not be overrun by Smokers / Hunters / Boomers.

That's still not enough zombies? Well, then, time to panic (A.K.A., mega-mob on demand)!

director_force_panic_event

Oh, no, you're still alive? Okay, try this:

director_panic_forever 1

But if you like beating the crap out of every single one, try this:

STEP 1: z_common_limit 400

z_special_spawn_interval 45 z_exploding_limit 1 z_gas_limit 1 z_hunter_limit 1 z_minion_limit 9 z_spawn mob z_spawn tank    (you will be overrun with lots of Infected if you try this)

Note: Of course, spawning too many zombies at the same time causes your computer to lag or even crash.

No more rescues
Don't like the fact that dead isn't dead? Fix it! The variable " " controls how far your teammates must get beyond your dead corpse before you can be rescued. Set to one light-year to preclude that ever happening. The second variable, " ", controls how many seconds must elapse after death before you come up for reincarnation. Set to a few centuries (that would be 6,294,240,000 seconds) to preclude that possibility.

rescue_distance 4500 rescue_min_dead_time 60

Bite me
What if Infected could kill you with one bite?

hunter_pz_claw_dmg 10 z_pounce_damage 5 // There's a delay of 1 second where a teammate can knock it off and you don't take this damage tongue_choke_damage_amount 10 z_hit_from_behind_factor 0.5 // If a zombie hits you in the back, multiplies the damage done z_witch_damage 100

Environmental and unknown damage modifiers:

inferno_damage 40 // Damage per second when getting flamed survivor_extra_damage_ammo_factor 1.25 // Appears to multiply the overall amount of                                           friendly fire damage. At zero, it does no                                          damage, even on expert though a decimal with many places will still do a good chunk with the Auto Shotgun. Does not appear to change damage on Infected at all. TODO: test this more z_gun_damage 10 // Melee damage done to doors, boxes, and the like, but not Infected

Walk or sprint?
Don't like the fact that you have a walk key instead of a sprint key? Set this variable to something ludicrous like 5,000...

survivor_walk_speed 85 // For reference base, movement speed is 210 and base Infected speed is 250

Still not fast enough? Use the following to get in and out of the action at faster than light speeds. REQUIRED: you must be game host

warp_all_survivors_here  // Warp all survivors to the player's cursor warp_all_survivors_to_battlefield // Warp all Survivors to the battlefield warp_all_survivors_to_checkpoint // Warp all Survivors to the exit checkpoint warp_all_survivors_to_finale // Warp all Survivors to the finale radio warp_far_survivor_here // Teleport the farthest away Survivor to your cursor position warp_to_start_area // Warp yourself to a Survivor spawn area

Versus Mode for the Man With No Friends
Well, maybe "no friends" is a bit drastic, but this will help you when you need some Versus and have no one to play with.

sv_cheats 1 sb_all_bot_team 1 sb_unstick 0 (stops bots teleporting) vs_max_team_switches 99 chooseteam (or use "M" or whatever key you have assigned to team change) mp_gamemode versus

Do note that the computer A.I. players will walk through the stage well enough, but may get hung up when it comes to pushing certain buttons or leaving certain areas. Simply switch teams again, accomplish the goal, and switch back. Do take note that the map that you are playing is still a co-op map and may end prematurely once both teams have played through. To avoid this, vote for a change in campaigns to load the Versus version of the maps.

NOTE: This cheat has been patched. In order to do this, you must enter "sv_cheats 1; mp_gamemode versus". You must then finish the level and you will switch teams afterwards. If you want the AI to play with you, enter "mp_gamemode coop". The AI will then spawn other infected to play with you. They won't make the best decisions, and you will likely be the only one killing anyone. You can also play survival mode by entering "mp_gamemode survival". You cannot use this method for Left 4 Dead 2, as mp_gamemode is not recognized by the computer. You must enter "map mapname versus". For example, to play Versus Mode on The Hotel, you must enter "map c1m1_hotel versus". This will allow you to play Versus for the entire campaign. The switchteams command is also not recognized, so you can only switch once per map. Often, you will spawn in on the second or third map as the wrong team, so you can still switch. Sometimes, you will even spawn in as a Spectator. You will have all AI teammates, unlike the first Left 4 Dead where playing Versus by yourself meant by yourself.

NOTE: The AI survivors won't leave the safe room unless you enter "sb_all_bot_team 1". They will move through the level very fast, but they won't sit in the safe room for hours.

NOTE: With the release of The Sacrifice, the SB_ALL_BOT_TEAM command is no longer recognized, and has been replaced with SB_ALL_BOT_GAME, which will only work with the command line option '+allow_all_bot_survivor_team 1'. This is not a console command. This can be added by right clicking on the game in Steam, selecting "properties," clicking "Set launch options," and adding it there.

NOTE: If all of those don't work, try this: sv_cheats 1

sb_all_bot_team 1 sb_all_bot_team 1 is wrong sb_all_bot_game is right

director_no_human_zombie 0

director_force_versus_start

Then press "M." Then you can chose if you like to be an Infected (zombie)

or Survivor (Humans)

Survival mode for the person with no friends
Playing survival mode on single player is simple enough; it doesn't even require cheats. mp_gamemode survival changemap (map) The change map is required, or else you will have an empty co-op map.

LAN game
To play offline on a local LAN (works with Steam in offline mode and you only need one Steam account) sv_lan 1 sv_allow_lobby_connect_only 0 map Then without hitting enter after "map", you will see a list of available maps. typing the first letter of the map name will give you more choices. connect IP_ADDRESS
 * 1) Set launch option -console
 * 2) Launch the game on server and clients
 * 3) On the server, bring up the console (~) and type:
 * 1) Wait for the game to start
 * 2) Vote for the difficulty level you want.
 * 3) On the clients, bring up the console and type the following, replacing IP_ADDRESS with the servers LAN IP address:

Bile/Rock Target Practice
Let's face it―you know it, your parents know it, your dog knows it: Puking and throwing is hard as hell to master. These are a few simple commands you can use 5 minutes a day 3 times a week that will make you a sexy puking/throwing master, you know, just like those workout ads.

Basic sv_cheats 1 (You'll need this for all the commands) map l4d_airport03_garage versus (This level provides an extremly good practice environement, but you should try other maps, too) sb_all_bot team 1 (Without this, the game will shut down because there aren't players on the other team) sb_stop 1 (Without this, the Survivors will get in the way of your game; best to put this cheat in before sb_all_bot_team 1) Rock throw practice z_spawn tank z_tank_rock_debug 1 (Creates a small cube where your rock hits, helps get an idea of where your throws land) z_tank_throw_interval 1 (Makes the delay between throws nonexistent; just dont get used to throwing rocks like a submachine gun) z_spawn boomer (These provide excellent target practice) Bile practice z_spawn boomer z_vomit_debug 1 (Similar to z_tank_rock_debug 1, only it creates lines to show where the puke hitboxes travel. In other words, shows where you barf) z_vomit_interval 1 (What progress do you expect to make only puking every half-minute? Now you can do it every second. Again, don't get used to puking like a submachine gun)

Pitch Black Mode
Disable the white background fog to play the game without the unrealistic lighting effect. This was the original way the game was designed per the development team: "Left 4 Dead takes place in a variety of dimly lit night-time environments. Because of this, play testers weren't able to see zombie silhouettes in the mid-ground and background. Because of this, they were repeatedly getting mobbed. While sudden zombie attacks were unarguably scary, they were also frustrating—players weren't being given the information they needed to react. They wanted that "Here they come!" moment, and we weren't giving it to them. The solution? Light-colored fog. While not as realistic-looking as actual fog in some settings, it meant play testers could see attackers in the distance. Once they were able to anticipate attacks, play testers started to have a much better time." sv_cheats 1 fog_override 1 fog_enable 0

Full-Lit Mode (On by default if the map doesn't have any entities for lighting)
If you wish to explore the map in full daylight mode use: toggle mat_fullbright

Flashlight
Alternatively, if you wish to use your flashlight to see the difference between daylight and normal map lighting, use the following commands: r_flashlightconstant 1 // select constant attenuation instead of linear or quadratic light fall off. r_flashlightfov 179 // default is 53 degree cone. r_flashlightfar 9999

Taking screenshots
To hide crosshair and other overlay elements: sv cheats 1 hidehud 4 0 returns to normal. 2 and 3 toggle certain elements on/off.

Change Player Name
This allows a player to change their game name from their Steam name

setinfo "name" ""

This allows the name change to be bound to a key as well. Additionally, this is temporary and only lasts on the game you are on is finished or you leave.

NOTE: Sometimes your player name will save your name, but you can still change your name....

Kill
Do you want to end your cruel life? Just type " " in the console and you will die instantly. Is there a player that's being a pain? Then type " ". But it has to match the player's/NPC's name's case; so, to kill Bill, type " ". A side note is that you do not need to type the whole name; to kill Louis, for instance, you can simply type " " and your work is done. This won't work if someone else has L at the beginning of their name, so just keep going until the name string is unique.
 * Note: Using this code on Boomers will neither cover Survivors around him/her in Bile nor stumble anyone standing too close.

Explode
Maybe simple kill damage isn't enough. How about making it look like you just exploded? This works just like " " but instead, type " " and watch him fly far away and die!

Respawn
Type " " if you want to live again.

Additionally, you can type "respawn_all" to ressurect bots and other dead players.

Third-person
Tired of first-person view? Want to get a better look at that scratch on the back of Bill's shirt? Or maybe you don't want that nude mod you got of Zoey to go to waste? Type in " " or if you like it like Gears of War/Resident Evil/Mass Effect, type in " " to get a view from your shoulder.

firstperson thirdperson thirdpersonshoulder

Ignite yourself
The command "burn" gives you the fire decal on your screen and the ability to light movables by just jumping on them. Best used in combo with a Hunter as it gives you the extra damage. This command does no damage. Do not fart in the game or the Director will find you!

People Start Talking
Type " " to have your player say something. Most people have fun playing as Zoey and typing " " Nearly all of the commands for this command start with " " An update on Feburary 19th, 2010 has disabled this command for Left 4 Dead 2, but is still availible in the original. This does not require the use of "sv_cheats 1".

No Special Infected
Type in console "Director_no_special 1". In finales, there might still be certain Specials that will still spawn however, you can get rid of them by kicking them out. For example, "kick tank" or "kick hunter," you can bind the kick command to a key so when they show up, press the key you bound it to and it will just delete them.

Infinite Ammo
To have infinite grenades, ammo, or chainsaw fuel, just type in console "Sv_infinite ammo 1". Or if you just want it for your primary weapon, type "Sv_infinite_primary_ammo 1"

Items
To visually see all items that spawned (yellow), and that could possibly spawn in the map (white), use

director_debug_scavenge_items 1

General AI status
To see the general status of the AI Manager (Director), use:

director_debug 1

Left 4 Dead 2 Commands
'To activate cheats within Left 4 Dead 2'' start a map using the "map " code. Achievements will be turned off, however.''' Most commands from Left 4 Dead work in Left 4 Dead 2, but some have been removed: team_desired survivors_walk_speed If you use the command z_spawn mob in Left 4 Dead 2, some of the Uncommon Infected that appear in that level will be mixed in with the regular Common Infected. The new weapons in Left 4 Dead 2 can be acquired using the following commands.

Weapons As all of the original Left 4 Dead weapons appear in Left 4 Dead 2, you can spawn all of them (except for the pistol from Left 4 Dead)

NOTE: Some melee weapons can only be spawned in certain campaigns. For instance, the crowbar cannot be spawned in "Swamp Fever" unless you edit the text files in your games directory to be able to do so. give weapon_grenade_launcher // some people may have to rely on ent_create weapon_grenade_launcher give rifle_desert (Gives the Combat Rifle) give rifle_ak47 give pistol_magnum give shotgun_chrome give shotgun_spas give sniper_military give smg_silenced give vomitjar (Bile bomb) give defibrillator give electric_guitar give machete give frying_pan give katana give rifle_m60

You can also use the console to give your weapon any of the three upgrades in Left 4 Dead 2. upgrade_add LASER_SIGHT upgrade_add explosive_ammo upgrade_add INCENDIARY_AMMO

The explosive ammo can be modified with the following commands. Setting one of the force commands too high will result in the game crashing. upgrade_explosive_bullet_force (explosive force for all weapons other than shotguns) upgrade_explosive_slug_force (explosive force for shotguns) upgrade_show_explosive_ammo_radius (changing to 1 causes a sphere to be shown whenever and explosive shot is fired, depicting it's effective area)

The Special Infected new to Left 4 Dead 2 can also be spawned z_spawn spitter z_spawn jockey z_spawn charger

Playing any Mutations
The following commands will allow you to play any of the revealed Mutations with bots. map mutation# //Replace # with a number: mutation1 = Last Man On Earth mutation2 = Headshot! mutation3 = Bleed Out mutation4 = Hard Eight mutation5 = Four Swordsmen mutation6 = Nothing mutation7 = Chainsaw Massacre mutation8 = Iron Man mutation9 = Last Gnome On Earth mutation10 = Room For One mutation11 = Healthpackalypse! mutation12 = Realism Versus mutation13 = Follow the Liter mutation14 = Gib Fest mutation15 = Versus Survival mutation16 = Hunting Party mutation17 = Lone Gunman mutation18 = Bleed Out Versus mutation19 = Taaannnkk! mutation20 = Healing Gnome community1 = Special Delivery community2 = Flu Season community3 = Riding My Survivor community4 = Nightmare community5 = Death Door community6 = Confogl It is recommended that sb_all_bot_game is set to 1 if playing a competitive Mutation alone as the game will disconnect due to lack of players.

Complete list of commands
See: Complete list of console commands

Also, don't forget "bind"; use this to make madness such as: bind "g" "z_spawn tank" With this, every time you press "G," you will spawn a Tank. However, keep in mind that the default limit of Special Infected is four (not counting Tanks or Witches), so if there are already four Special Infected spawned by the Director, you cannot spawn more. The Director-spawned Infected must be killed before more can be spawned.

Bots copy your actions
Like the effect of Follow the Leader? Then you could manipulate the actions your CPU-controlled allies and the CPU-controlled Special Infected (Special Infected who are playable in Versus Mode). Every movement you make will be followed by these bots, thus negating their A.I. functionality. These are all applied with the console command below; bot_mimic 1 To simplify its functions, let us just say; Every movement you make affects the movement of the bots, you shoot, the bots shoot (and the Special Infected use their Special abilities), you walk forward, they also walk forward. This is a strategy if you want to direct the actions of the bots around you. Such as when you are ridden by a Jockey, this console command allows you to control both your player and the Jockey itself!
 * When this command is enabled, the human player cannot use items, pick up weapons, etc (deactivating the Use key), it is up to him to direct the bots to the items, since they can do it instead.

Force Uncommon Zombies
Type "z_forcezombiemodelname common_male_(Infected);z_forcezombiemodel 1;z_spawn"Fixed By Unknown 0racle

Replace "(Infected)" with the names below:

ceda = Hazmat CEDA zombies from "Dead Center".

jimmy = Jimmy Gibbs zombie from "Dead Center"'s last level.

fallen_survivor = The Fallen Survivor from "The Passing".

clown = Clowns from "Dark Carnival".

mud = Mud-Men from "Swamp Fever".

riot = Riot Cops from "The Parish".

worker = Workers from "Hard Rain".

(Not sure this is the right code; test this one and if it's not right, try a few codes and replace this one with the working one if you find it.)

If you use the Fallen Survivor, you might want to use these:

z_fallen_kill_supress_time 1 z_fallen_max_count 30