Assigning the key for a derma menu

Ok, So I’ve made a Derma menu that drops down a website. To get it down you have to use a console command, but I need the menu to be at F4 at default for every player that joins my server.

How do I do that? I’ve read through every guide on wiki.garrysmod but I can’t find out how to make the menu drop down by pressing F4, without binding anything.

Thanks.

**[Gamemode.ShowSpare2

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.ShowSpare2)** hook to this and run the console command.

For F1-F4 you can use gamemode hooks (**[Gamemode.ShowHelp

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.ShowHelp)** (F1), **[Gamemode.ShowTeam

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.ShowTeam)** (F2), **[Gamemode.ShowSpare1

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.ShowSpare1)** (F3) and **[Gamemode.ShowSpare2

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.ShowSpare2)** (F4)). Hook to one of these, and send a usermessage which will tell the client to open the Derma Menu.

Thanks guys!
Is it possible to bind it any other button, like “Home” or “F5”?

Yes, with a think hook and input.IsKeyDown:

[lua]hook.Add( “Think”, “MenuKeyListener”, function()
if ( input.IsKeyDown( KEY_F5 ) and !menuOpen ) then
createMenu()
end
end )[/lua]

-snip-

I don’t that would work, because if you scroll down on THIS to the bit where it has all of the red functions you cannot run them
Then as you’ll see one of the non useable functions is

Oh.

I’m really new to these hooks. My Derma menu looks like this:

[lua]function WEB()
local frame = vgui.Create(“DFrame”)
frame:SetSize(ScrW() - 200, ScrH() - 200)
frame:Center()
frame:MakePopup()
frame:SetTitle(“Forums”)
frame:ShowCloseButton(true)

local html = vgui.Create("HTML",frame)
html:SetPos(20,30)
html:SetSize(frame:GetWide()-40,frame:GetTall()-60)
html:OpenURL("http://url/");
end
concommand.Add( "web", WEB )[/lua]

I want that to be bound to F5.

try this:

[lua]
function WebShow( ply )
ply:ConCommand( “web” )
end
hook.Add(“ShowSpare2”, “WebShow”, WebShow)
[/lua]

note that will bind it to F4. As using the bind command on a player is not allowed, you have to use one of the pre-assigned gamemode keys.

You might also try **[Player.ConCommand

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.ConCommand)**. Not sure if its also limited to that red list.

I put it in the cl_hooks, wouldn’t work :S