Garry's Mod

Garry's Mod

View Stats:
da bat Mar 16, 2016 @ 1:32pm
how do i make a bind toggle in gmod? (example) bindtoggle q +menu. this dont work D; plz help
plz help:steamhappy:
< >
Showing 1-15 of 23 comments
Harichi Mar 16, 2016 @ 3:06pm 
You can't toggle a bind from what I know.
Well, you can, but you need to do complicated things like writing your own config file, but I don't know how to do that.
NotSoMewwo Mar 16, 2016 @ 4:16pm 
2
Here is how a bind toggle works
bindtoggle o "sv_cheats 0 1"
This toggles sv_cheats 0 to 1 then to 0

Here is the one you want :
bind q toggle
alias toggle "enable"
alias enable "alias toggle disable; +menu"
alias disable "alias toggle enable; -menu"
(Code taken from TF2 wiki ( https://wiki.teamfortress.com/wiki/Scripting )
Last edited by NotSoMewwo; Mar 16, 2016 @ 4:17pm
da bat Mar 17, 2016 @ 1:08pm 
thx




























Fantastic Mr. Fox Aug 23, 2016 @ 7:18am 
GUYS ALL YOU NEED TO DO IS THIS
Fantastic Mr. Fox Aug 23, 2016 @ 7:19am 
BindToggle (key) "(command)"
and thats it
Gila Monster Aug 23, 2016 @ 7:29am 
.
da bat Aug 26, 2016 @ 12:23pm 
this was like 5 months ago xD
Agent Ulgrin Aug 26, 2016 @ 12:26pm 
Originally posted by Napkin:
plz help:steamhappy:

bind p unbindall
jolt527 Nov 11, 2017 @ 12:55pm 
2
Originally posted by NotSoNewwo:
Here is how a bind toggle works
bindtoggle o "sv_cheats 0 1"
This toggles sv_cheats 0 to 1 then to 0

Here is the one you want :
bind q toggle
alias toggle "enable"
alias enable "alias toggle disable; +menu"
alias disable "alias toggle enable; -menu"
(Code taken from TF2 wiki ( https://wiki.teamfortress.com/wiki/Scripting )

The above code works, but when I went into the scripting link provided, I found that this was a little difficult to take apart and understand, seeing how there's an actual "toggle" command listed in that link that's different from the "toggle" alias being defined here. Here's a slightly different version:

bind q toggle_menu alias toggle_menu "menu_on" alias menu_on "alias toggle_menu menu_off; +menu" alias menu_off "alias toggle_menu menu_on; -menu"

The first line binds the q key to the toggle_menu command to be implemented. The second line sets the initial execution of the toggle_menu command to execute the menu_on command. The third and fourth lines basically modify the toggle_menu command to switch back and forth between the menu_on and menu_off commands, and then the menu is shown or hidden based on which of those two commands is active at the time.

Also, to make this work without having to enter it into the console each time you startup Gmod, you can put those lines into the autoexec.cfg file, found in the Steam/steamapps/common/GarrysMod/garrysmod/cfg directory.
Last edited by jolt527; Nov 11, 2017 @ 12:56pm
Harichi Nov 11, 2017 @ 2:40pm 
Originally posted by Big Boss:
Originally posted by NotSoNewwo:
Here is how a bind toggle works

This toggles sv_cheats 0 to 1 then to 0

Here is the one you want :

(Code taken from TF2 wiki ( https://wiki.teamfortress.com/wiki/Scripting )

The above code works, but when I went into the scripting link provided, I found that this was a little difficult to take apart and understand, seeing how there's an actual "toggle" command listed in that link that's different from the "toggle" alias being defined here. Here's a slightly different version:

bind q toggle_menu alias toggle_menu "menu_on" alias menu_on "alias toggle_menu menu_off; +menu" alias menu_off "alias toggle_menu menu_on; -menu"

The first line binds the q key to the toggle_menu command to be implemented. The second line sets the initial execution of the toggle_menu command to execute the menu_on command. The third and fourth lines basically modify the toggle_menu command to switch back and forth between the menu_on and menu_off commands, and then the menu is shown or hidden based on which of those two commands is active at the time.

Also, to make this work without having to enter it into the console each time you startup Gmod, you can put those lines into the autoexec.cfg file, found in the Steam/steamapps/common/GarrysMod/garrysmod/cfg directory.
necro, matey
GET TO DA CHOPPA! Nov 13, 2017 @ 1:18am 
People google shizzle like this, so it usefull to add to (old) incomplere info right? I don't understand the endless complaining about necro, could someone explain me the actual problem here? I for one found the added information usefull.
Last edited by GET TO DA CHOPPA!; Nov 13, 2017 @ 1:20am
Harichi Nov 13, 2017 @ 4:04am 
Originally posted by Get To Da Choppa!:
People google shizzle like this, so it usefull to add to (old) incomplere info right? I don't understand the endless complaining about necro, could someone explain me the actual problem here? I for one found the added information usefull.
yeah there is no problem with it, it's better than starting your own thread I guess.
jolt527 Nov 13, 2017 @ 9:01pm 
Originally posted by Hærichi:
Originally posted by Get To Da Choppa!:
People google shizzle like this, so it usefull to add to (old) incomplere info right? I don't understand the endless complaining about necro, could someone explain me the actual problem here? I for one found the added information usefull.
yeah there is no problem with it, it's better than starting your own thread I guess.

This was one of the first things that popped up on Google when I was searching for how to do this, so I replied mainly to help others. If people get all up in arms about necro, maybe they shouldn't reply and just let it die? :)
If you want to do the same with the context menu, try this:

alias "mc_open" "+menu_context; bind w "mc_close""
alias "mc_close" "-menu_context; bind w "mc_open""
bind [key] "mc_open"
RoshKin09 Mar 27, 2019 @ 1:28pm 
you guys know how to toggle bind two commands on a seprate keys?
i been trying to toggle leaning
< >
Showing 1-15 of 23 comments
Per page: 1530 50

Date Posted: Mar 16, 2016 @ 1:32pm
Posts: 23