• Garry's Mod VGUI Derma F1 Menu Help.
    5 replies, posted
[B]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.[/B] I Only have 2 files in here, [B]cl_init.lua >[/B] 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 ) [B]sv_init.lua >[/B] function GM:ShowHelp( Player ply ) umsg.Start( "Openpls", ply ) umsg.End() end [B]Nothing Opens When I Press F1 Or Any Other Keys.[/B] [B]PS. I Looked At Wiki And Nothing Has Worked.[/B]
[CODE] hook.Add("ShowHelp","customf1menu",function(ply) --stuff here end) [/CODE] Hooks > overwriting functions
[QUOTE=LUModder;46076617][CODE] hook.Add("ShowHelp","customf1menu",function(ply) --stuff here end) [/CODE] [B]So What Would I Exactly Put In Lua File? , This?[/B] 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) Hooks > overwriting functions[/QUOTE] [editline]25th September 2014[/editline] [B][I]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)[/I][/B] 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: [code] hook.Add("ShowHelp","customf1menu",function(ply) umsg.Start( "Openpls", ply ) -- Sending a message to the client. umsg.End() end) [/code]
[B]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! :)[/B]
Sorry, you need to Log In to post a reply to this thread.