Garry's Mod VGUI Derma F1 Menu Help.

**Hi, I’m Looking to create a menu that shows information of server or just something like that when i press F1.
and i am using darkrp 2.5 as my gamemode.

I Created this, but it doesent work. #Noob.

Addons > darkrpmodification-master > lua > darkrp_modules > captains_f1menu > my files are here.**

I Only have 2 files in here,

cl_init.lua >

function MyMenu()
local base = vgui.Create(“DFrame”)
base:SetPos( ScrW() / 2 - 400, ScrH() / 2 - 400 )
base:SetSize( 800, 700 )
base:SetVisible( true )
base:SetTitle( “My F1 Base” )
base:SetDraggable( false )
base:ShowCloseButton( true )
base:MakePopup()
end
usermessage.Hook( “Openpls”, MyMenu )

sv_init.lua >

function GM:ShowHelp( Player ply )
umsg.Start( “Openpls”, ply )
umsg.End()
end

Nothing Opens When I Press F1 Or Any Other Keys.
PS. I Looked At Wiki And Nothing Has Worked.

You should not need the “Player” parameter.



hook.Add("ShowHelp","customf1menu",function(ply)
--stuff here
end)


Hooks > overwriting functions

[editline]25th September 2014[/editline]

hook.Add(“ShowHelp”,“customf1menu”,function(ply)
function GM:ShowHelp( ply ) – This hook is called everytime F1 is pressed.
umsg.Start( “Openpls”, ply ) – Sending a message to the client.
umsg.End()
end)

Do I Use This Code as my sv_init.lua ?

Your still using the overwriting function that should onl be used when handling gamemodes.
Use the hook and remove the function inside. So your left with this:



hook.Add("ShowHelp","customf1menu",function(ply)
umsg.Start( "Openpls", ply ) -- Sending a message to the client.
umsg.End()
end)


Okay Everythings Working !
Thanks so much you guys!,
I do need help adding things to it since its blank atm
but i wouldnt wanna ask for any more than i already have so i will have to figure out the rest on my own xD
thanks though good luck on anything you’re doing to! :slight_smile: