Hello everyone,
I’d like to introduce a simple way on how to toggle between certain actions/commands Ingame.
This guide is going to be a Step by Step guide with easy screenshots and instructions. Feel free to leave any question, comment or TIP in the comments.
The following steps are going to be an example on 'how to /me mutes his radio and /me unmutes his radio.' Meaning that whenever Goverment Members press their 'Default H' It would say *Mutes his radio* and *Unmutes his radio* whenever you press it again.
Step #1 – Locate the CFG Folder
Step #2 - Create a 'Text Document' as 'ToggleMute'
Step #3 - Copy and paste the following code
Step #4 -Saving the code
The following screenshots will guide you on how to safe the code correctly.
Step #5 - Locate the 'autoexec.cfg' folder
Step #6 - Open the 'autoexec.cfg' and paste in the following
Step #7 - Save the 'autoexec.cfg' folder (CTRL+S)
Q&A
Q: Am I able to use this same method on with other actions/command?
A: Yes, you can use this same method to create;for example, toggle crouch.
Q: How does the command work?
A: The command is pretty simple, the entire string of 'mini commands' is to create a simple toggle between certain commands. You are able to bind two commands to a single key ingame (bind {key} "{command1}; {command2}") this is practicly the same, you are only giving it a few names so the game registers it as a string of commands. Having it in the autoexec makes to boot up everytime you start Garry's Mod up.
Q: Does this requires you to restart Garry's Mod?
I No it does not, you can simply go into your ingame console and typ "exec {command name}" example: exec Toggleradio this will trigger the command in the 'autoexec.cfg' file and allows it to instantly work ingame.
Simply follow all the steps from before once you understand how to change to code for your commands.
How To: Give it a simple name so the code registers it {Name#1} add the command and or action. Give it a 2e name (name#2) this is so the game knows what command to execute whenever you boot up Garry's Mod. Fill the name#1 and name#2 for whatever you picked and add up a key and you are done.
Enjoy!
I’d like to introduce a simple way on how to toggle between certain actions/commands Ingame.
This guide is going to be a Step by Step guide with easy screenshots and instructions. Feel free to leave any question, comment or TIP in the comments.
The following steps are going to be an example on 'how to /me mutes his radio and /me unmutes his radio.' Meaning that whenever Goverment Members press their 'Default H' It would say *Mutes his radio* and *Unmutes his radio* whenever you press it again.
Step #1 – Locate the CFG Folder
Open the CFG Folder and continue to Step #2
Step #2 - Create a 'Text Document' as 'ToggleMute'
Open the Text Document you created and follow Step #3
Step #3 - Copy and paste the following code
Code:
alias mute_on "say /me mutes his radio; alias togglemute mute_off"
alias mute_off "say /me unmutes his radio; alias togglemute mute_on"
mute_off
bind h togglemute
Step #4 -Saving the code
The following screenshots will guide you on how to safe the code correctly.
- 1 - 'Save as'
- 2 - 'All files'
- 3 - 'ToggleMute.cfg'
Save the file now, it should appear within your folder as a 'notepad'
Step #5 - Locate the 'autoexec.cfg' folder
Step #6 - Open the 'autoexec.cfg' and paste in the following
Code:
exec ToggleMute
Step #7 - Save the 'autoexec.cfg' folder (CTRL+S)
Q&A
Q: Am I able to use this same method on with other actions/command?
A: Yes, you can use this same method to create;for example, toggle crouch.
Q: How does the command work?
A: The command is pretty simple, the entire string of 'mini commands' is to create a simple toggle between certain commands. You are able to bind two commands to a single key ingame (bind {key} "{command1}; {command2}") this is practicly the same, you are only giving it a few names so the game registers it as a string of commands. Having it in the autoexec makes to boot up everytime you start Garry's Mod up.
Q: Does this requires you to restart Garry's Mod?
I No it does not, you can simply go into your ingame console and typ "exec {command name}" example: exec Toggleradio this will trigger the command in the 'autoexec.cfg' file and allows it to instantly work ingame.
Code:
alias {name1}_on "{command/action 1}; alias {name2} {name1}_off"
alias {name1}_off "{command/action 2; alias {name2} {name1}_on"
{name1}_off
bind {key} {name2}
Simply follow all the steps from before once you understand how to change to code for your commands.
How To: Give it a simple name so the code registers it {Name#1} add the command and or action. Give it a 2e name (name#2) this is so the game knows what command to execute whenever you boot up Garry's Mod. Fill the name#1 and name#2 for whatever you picked and add up a key and you are done.
Enjoy!
Last edited: