Toggle Method V2
#1
Lightbulb 
Step by step guide on creating keybindings that can toggle on/off


Step #1 - Locate your cfg folder

[Image: 4CWMvmx.png?1]



Step #2 - Create a text document accordingly to what you want.

[Image: fkldVa1.png?1]




Step #3 - Open your document and paste the following format;
(Pre-made formats can be found on the end of the Post)

Quote:alias {name}_on "{command}; alias {alias name} {name}_off"
alias {name}_off "{command}; alias {alias name} {name}_on"
{name}_on
bind {keybinding} {alias name}



Step #4 - Saving your document.

Click on file > Save As...
[Image: dM8CrmU.png?1]



Select "All Files" at 'Save as type'
[Image: Qhx4CNW.png?1]



Rename and save your document accordingly, edit the .txt to .cfg on the end of your document.
[Image: t2nGIwx.png?1]




Step #5 - Locate the 'autoexec.cfg' file in the same folder.

[Image: SKC8NOx.png?1]



Step #6 - Open 'autoexec.cfg' and typ in the following;

Quote:exec {name of your document}


Step #7 - Ingame Console Command
Open your ingame console and use the following to run your keybinding without having to restart your Garrys Mod.
Quote:exec {document name}



Formats for "Toggle Keybindings"

Toggle Voiceradio

Quote:alias radio_on "say /voiceradio on; alias toggleradio radio_off"
alias radio_off "say /voiceradio off; alias toggleradio radio_on"
radio_on
bind j toggleradio


Toggle Engine

Quote:alias engine_on "say /engine on; alias toggleengine engine_off"
alias engine_off "say /engine off; alias toggleengine engine_on"
engine_on
bind g toggleengine


Toggle Speaking Voiceradio

Quote:alias zoom_on "+zoom; alias togglezoom zoom_off"
alias zoom_off "-zoom; alias togglezoom zoom_on"
zoom_on
bind b togglezoom


Toggle Crouching

Quote:alias crouch_on "+duck; alias togglecrouch crouch_off"
alias crouch_off "-duck; alias togglecrouch crouch_on"
crouch_off
bind ctrl togglecrouch
[Image: jfQuooI.png?1]
The following 3 users Like Brikaas's post:
  • max., Slaint, TheSiphon
#2
Amazing!
[Image: 0SSh1TN.png]
#3
Moved to Useful Docs
Regards,
Connnnnnnn

Consider giving me a rep point here.

The following 1 user Likes Conn's post:
  • Brikaas
#4
This is great! Thank you!


Forum Jump:


Users browsing this thread: 1 Guest(s)