• How would I use GM:PlayerBindPress() the way I need to?
    1 replies, posted
[code]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 [/code] Would I do something like this if I'm going to make it so that you use a different menu with a different bind? [code]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 [/code]
This won't work for commands with + or - prefixes: [IMG]http://puu.sh/hRxsR/b47630fbbb.jpg[/IMG] 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: [CODE]hook.Add("ContextMenuOpen", "", function() return false; end); hook.Add("OnContextMenuOpen", "", function() print("opened"); end); hook.Add("OnContextMenuClose", "", function() print("closed"); end);[/CODE]
Sorry, you need to Log In to post a reply to this thread.