• How to make key bind to open and close the menu?
    0 replies, posted
I came up with this code that opens the menu: [code] local FKeyMenus = { KEY_F4 = phm_1; KEY_C = phm_1; }; hook.Add( "PlayerBindPress", "PlayerBindPressFKeyMenus", function( _p, _bind, _pressed ) local _key = "KEY_" .. string.upper( input.LookupBinding( _bind ) ); local _func = FKeyMenus[ _key ]; if ( _func ) then _func( LocalPlayer() ); end end); [/code] I want to make that first time you press KEY_C or KEY_F4 menu opens, second time when menu is open and you press the KEY_ it will close the menu.
Sorry, you need to Log In to post a reply to this thread.