How would I use GM:PlayerBindPress() the way I need to?


function GM:PlayerBindPress( ply, bind, pressed )
MsgN(bind)
if LocalPlayer() then
if ( string.find( bind, "menu_context" ) ) then 
print(pressed)
if pressed then
DermaPanel:Show()
gui.EnableScreenClicker(true)
else
DermaPanel:Hide()
gui.EnableScreenClicker(false)
end
end
end
end


Would I do something like this if I’m going to make it so that you use a different menu with a different bind?


function GM:PlayerBindPress( ply, bind, pressed )
MsgN(bind)
if LocalPlayer() then
if ( string.find( bind, "menu_context" ) ) then 
print(pressed)
if pressed then
DermaPanel:Show()
gui.EnableScreenClicker(true)
else
DermaPanel:Hide()
gui.EnableScreenClicker(false)
end
end
if ( string.find( bind, "whateverbindimusing" ) ) then
print(pressed2)
if pressed then
DermaPanel2:Show()
gui.EnableScreenClicker(true)
else
DermaPanel2:Hide()
gui.EnableScreenClicker(false)
end
end
end
end


This won’t work for commands with + or - prefixes:

http://puu.sh/hRxsR/b47630fbbb.jpg

As you can see it only prints when you pressed the bind, and doesn’t print anything when you released it.

This works fine for normal commands though.

Now for replacing the context menu you could try this:


hook.Add("ContextMenuOpen", "", function() return false; end);

hook.Add("OnContextMenuOpen", "", function()
	print("opened");
end);

hook.Add("OnContextMenuClose", "", function()
	print("closed");
end);