How would I bind a key to the context menu?

I know that TTT does it and fretta does something like it when you’re in spectator mode.

**[Gamemode.KeyPress

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.KeyPress)**

Like that?

yes, thanks.

np

**[Gamemode.OnContextMenuOpen

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.OnContextMenuOpen)**

**[Gamemode.OnContextMenuClose

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.OnContextMenuClose)**

Those two don’t allow you to assign a key to opening the context menu, just executes some code when it is opened / closed

He asked how TTT did it

It was resolved 11 hours ago.

I had something else to add and I did, out of my own free will.

Yeah, don’t shoot down Willox’s answer just because he used mine, the player can manually go in and bind a key to context menu, he may want to use Willox’s answer to execute code when they open it

Actually, the one c-unit posted wasn’t really what I was looking for, this I can easily use. The other one made you have to do all this coding to check if it opened.

That’s because the one I posted is just to make sure a character has the key bound to it.

[editline]28th October 2010[/editline]

that’s how i would use it anyways, if they push c then open the context menu, then use game.OnContextMenuOpen to do something