How to toggle in console command in Left 4 Dead 2?

How to toggle in console command in Left 4 Dead 2? - DJ Mixing Music on a Console

I have this command then how to toggle.

bind p "noclip"

when I press P, it activate noclip, then when I press P again it will off.



Best Answer

The bind command allows other console commands to be toggled on and off with one keypress.

To toggle noclip:

bind "p" "noclip"

The quotes are strongly recommended so the command will never fail even if a special character is used. Be sure to turn cheats on first by typing sv_cheats 1 in the console.




Pictures about "How to toggle in console command in Left 4 Dead 2?"

How to toggle in console command in Left 4 Dead 2? - Close-up Photo of Skull
How to toggle in console command in Left 4 Dead 2? - Black and White Audio Mixer
How to toggle in console command in Left 4 Dead 2? - Black and Silver Audio Mixer



How do you activate cheats on Left 4 Dead?

Here's how:
  • Go to Main Menu > Options > Keyboard/Mouse, then enable Allow Developer Console.
  • Load the game, then press the tilde (~) key to open the console.
  • Type sv_cheats 1 at the prompt and press Enter to enable cheats.


  • How do you text in Left 4 Dead 2?

    on default "Y" for the general chat and "U" for team chat. Thanks all!



    Top 10 Useful Console Commands ★ Left 4 Dead 2




    More answers regarding how to toggle in console command in Left 4 Dead 2?

    Answer 2

    If you cannot use bindtoggle (bindtoggle p "sv_cheats 0 1"), you can try a "cascading alias" setup. What you do is bind the key to your own alias command:

    alias fooAlias "fooAliasEnable"
    alias fooAliasEnable "sv_cheats 1; alias fooAlias fooAliasDisable"
    alias fooAliasDisable "sv_cheats 0; alias fooAlias fooAliasEnable"
    bind p fooAlias
    

    So what happens is the key is bound to a single alias, that alias calls a second alias, and that second alias resets the first alias to a different second alias. This can be extended beyond 2 and so is more general than a simple toggle.

    Not actually tested, but check google for more info.

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Mustata Silva, Mitja Juraja, Alexandra Georgieva, Boris Hamer