Q menu/Spawn Menu

Straight to the point. How would i create a spawnmenu that comes up when i push Q. I have no idea how to start and have messed around with functions such as GM:OnSpawnMenuOpen() but still cannot figure out how it is done. Any help will be much appreciated.

I did search for this but couldn’t find a thread that was quite what i wanted.

Are you willing to have it derived from sandbox? (So you basically have the basic sandbox menu and some of it’s features), but you could always change it.

You would have to use derma to make the spawn list, then to get the derma to pop up on Q you would have to add the commands:
concommand.Add( “+menu”, <function name here> ) – this will open the menu when we hit q.
concommand.Add( “-menu”, function() <derma name here>:Close() end ) – this will close the menu when we let go of q.

In my gamemode I have a custom Q menu. I think I used the hook you mentioned in the OP which I hooked client-side. Sadly I’m going away for a week from today so I can’t check

When you say function name, you mean say, function Spawnmenu, then the derma inside it? And the derma name is just something like: Name = vgui.Create( “DFrame” ), so the derma name is Name. I hope that made sense. Then i take it that, that code goes in init.lua and the function goes inside cl_init.lua , i know it’s pretty nooby but this is newby questions right :slight_smile:


I put that code in my gamemode and I get: Unknown Command: ‘+menu’ and Unknown Command: ‘-menu’ which i don’t understand because isn’t that what concommand.Add( “+menu”, does?. Help please

its giving you an error because you are creating a clientside command on the server.

All the code goes into cl_init.lua because it is meant to be executed by the CLIENT and not the SERVER.
Once you put the entire code that has to relate to the menu into the client, try testing it again and letting us know what the result is.

I did put the code in cl_init.lua and that was the result. Maybe i should have said that. My bad.


Will not having derived the gamemode from sandbox have anything to do with this? I want to try not to derive my gamemode from sandbox if possible.

no it should not. Whats the name of your function? I’m pretty sure it has to be “menu” for it to work.

I changed the function name to menu and it worked. Thanks for all the help. Sorry for not responding in a long time, i was on holiday :slight_smile: