I'm trying to create a bind to mute the voice chat, but also tell in chat whether I muted them or not. The only information I can find on toggling is the toggle commands:
bind <key> <command> 0 1
I tried doing bind k "toggle voice_enable;say Silent Mode: " "on" "off"
, but it did not work.
So I want this (bind k "toggle voice_enable;
) to say one of these two messages:
"say -*- Silent Mode -*- Player(s) Muted "
and
"say -*- Silent Mode -*- Player(s) Un-Muted "
How can I do it?
Best Answer
Toggling between commands that don't involve a simple 1 and 0 is a bit tricky, but all it requires is the use of a few
alias
commands. Here's a working example of what you want:Here's what this is doing:
toggleVoice
that is created in the next step.alias
to create a custom command namedtoggleVoice
that runs the custom commanddisableVoice
created in the next step.alias
to create a custom command nameddisableVoice
that alters step 2 to maketoggleVoice
run the custom commandenableVoice
next time, disable voice transmission, and print "Silent mode ON" in chat.alias
to create a custom command namedenableVoice
that alters step 2 to maketoggleVoice
run the custom commanddisableVoice
next time, enable voice transmission, and print "Silent mode OFF" in chat.Basically we're binding a key to an alias that calls other aliases that alter it while also doing what you need in-game. Note that you'll need to add these to your autoexec.cfg file (or whatever file you set to auto-run when the game starts up) or else you'll have to enter these commands every time.