[HELP] Opening DermaMenu with Q like spawn menu.

So I’m trying to Open my Derma menu with the Q button and close when I release the Q button the closest I have gotten
was it spamming the menu…

Show us your code :stuck_out_tongue:

[editline]3rd December 2016[/editline]


I don’t have the code I used to spam it anymore and I don’t think posting my 300+ line derma code will be ethical but the Frame I used to parent everything is called Frame and the function it is under is QMenu()

K i’ve got something kind of working so It does what I want but It gives me an error…

function FrameVisible()
Frame:SetVisible( true )

function FrameInvisible()
Frame:SetVisible( false )

concommand.Add(“qmenu”, QMenu )

net.Receive( “QMenuInitialize”, QMenu )

function QKey_Check()
if input.IsKeyDown( KEY_Q ) then
FrameVisible()–The command for the menu im trying to open

So it does exactly what I want and opens/closes depending on whether I release it but I still get this error.

[ERROR] gamemodes/gmodlife/gamemode/vgui/cl_qmenu_menu.lua:247: attempt to index global 'Frame' (a nil value)
  1. FrameInvisible - gamemodes/gmodlife/gamemode/vgui/cl_qmenu_menu.lua:247
   2. fn - gamemodes/gmodlife/gamemode/vgui/cl_qmenu_menu.lua:262
    3. unknown - addons/ulib/lua/ulib/shared/hook.lua:110

[editline]3rd December 2016[/editline]

oh and here is my frame code.

Frame = vgui.Create( “DFrame” )
Frame:SetPos( 100, 100 )
Frame:SetSize( ScrW() / 1.5, ScrH() / 1.2 )
Frame:SetTitle( “” )
Frame:SetDraggable( false )
Frame:SetVisible( false )

[editline]3rd December 2016[/editline]

managed to fix it by placing it into the the QMenu() function

[editline]3rd December 2016[/editline]

another problem how can I have it so when I make a change to pm that the dermamodelpanel will not stay the same with out closing the frame and reopening?

A suggestion, don’t have a think hook constantly running checking if someone has their Q key pressed down.

Make a hook, which also works both on client and server side so that you don’t need to use nets, like this

and have it run when the user presses the key rather than having it keep checking.

You can use this,

to close the menu when the player releases the key.

Make sure all your code is client btw. Might be why you can’t get the Frame (which shouldn’t be named frame either way because of conflicting issues) to be global which it shouldn be anyways. Make it local to your client script file.