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.
Arqade is a question and answer site for passionate videogamers on all platforms. It only takes a minute to sign up.
Sign up to join this communityThe 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.
noclip 1
it's set just with noclip
, so there is no reason to use BindToggle
. just bind p "noclip"
will be sufficient to toggle it. I expect it's not working because the guy needs to enable cheats with sv_cheats 1
, and obviously it will only work in single player games.
Sep 14, 2018 at 11:55
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.