Open Menu With Q

How can you make a custom menu when you hold down Q?

I got rid of deprive gamemode Sandbox.

bind q (concomand for opening your menu)

I thought there was a certain command for it.

Thats some nice lua
Use that

Thanks. Thats better.


How do you make it stay open while your holding down q?

in the console its BindToggle

Or in your OnSpawnMenu function you can just alter between SetVisible(true) and SetVisible(false).

Or you can make a concommand called +menu.

If you mean you want it to only stay visible while Q is down simply show it with **[Gamemode.OnSpawnMenuOpen](** and hide it with **[Gamemode.OnSpawnMenuClose](**.

Or you can make a concommand called +menu to open it and -menu to close it.

But then you have to tell your clients to bind a key to it.

But their q button is already bound to +menu.

Or am I missing something?

No, it’s probably me. Haven’t played Garry’s Mod in months. :smile:

It’s much better to just do what Quebec said.
You don’t need to do anything with key binds.

What yakahughes is saying is that Q by default is already bound to +menu.

Edit*Heres an example.

local toggle =0

  function togglespawn()
if toggle==2 then
return false

  hook.Add("OnSpawnMenuClose", "togglespawn", togglespawn)
hook.Add("OnSpawnMenuOpen", "togglespawn2", togglespawn)

This might help

function GM:OnSpawnMenuOpen()
your custom spawnmenu

function GM:OnSpawnMenuClose()
– we’re setting it to close and open like that to make sure all tooltips are removed