2

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?

  • 1
    I'd recommend using "say_team" if you usually play on competitive. – Ave Nov 28 '15 at 10:20
3

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:

bind k toggleVoice;
alias toggleVoice "disableVoice";
alias disableVoice "alias toggleVoice enableVoice; voice_enable 0; say Silent mode ON";
alias enableVoice "alias toggleVoice disableVoice; voice_enable 1; say Silent mode OFF";

Here's what this is doing:

  1. Bind k to the custom command toggleVoice that is created in the next step.
  2. Use alias to create a custom command named toggleVoice that runs the custom command disableVoice created in the next step.
  3. Use alias to create a custom command named disableVoice that alters step 2 to make toggleVoice run the custom command enableVoice next time, disable voice transmission, and print "Silent mode ON" in chat.
  4. Use alias to create a custom command named enableVoice that alters step 2 to make toggleVoice run the custom command disableVoice 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.