Page 1 of 1

Echo on toggle function

Posted: Sun Jul 09, 2017 5:43 am
by Shocker
Hey, I'm looking for a way to put an echo message on a toggle, e.g., I want to bind a single key to toggle antiping and recieve a message "antiping on/off"
I can easily bind 2 keys for that:

Code: Select all

bind key1 "cl_antiping 0; echo antiping off"
bind key2 "cl_antiping 1; echo antiping on"
Idk if there's a way to put both binds together on a key, like:

Code: Select all

bind key "toggle cl_antiping 0 1; toggle echo "antiping on" "antiping off" "
I thought it can be done using cfg files, but I don't know if I can call 2 differents cfg files with exec function bounds on a single key.
Any way to do this? Thanks.

Re: Echo on toggle function

Posted: Sun Jul 09, 2017 7:53 am
by deen
antipingon.cfg:

Code: Select all

cl_antiping 1
echo antiping on
bind v exec antipingoff.cfg
antipingoff.cfg:

Code: Select all

cl_antiping 0
echo antiping off
bind v exec antipingon.cfg
Then just F1, exec antipingon.cfg

Re: Echo on toggle function

Posted: Sun Jul 09, 2017 6:36 pm
by Shocker
Wow nice, thanks deen :D

Re: Echo on toggle function

Posted: Tue Jul 11, 2017 11:55 am
by Index
Yeah thanks for the idea :3 That can be added to extend sooo many useful binds.
Maybe I'll someday write a paragraph about it in the Just bind It Tutorial for sure .__.