• Only responding to key presses when in-game
    2 replies, posted
I need a menu to appear when a player presses the i key, which works. However, it also appears when the player is typing a chat message or is typing something in the console. I solved the issue when using the chatbox with: [lua]function GM:StartChat() self.InputEnabled = false end function GM:FinishChat() self.InputEnabled = true end[/lua] And I tried this for the menu and console: [lua]function GM:PlayerBindPress( ply, bind, pressed ) if ( string.find( bind, "toggleconsole" ) or string.find( bind, "cancelselect" ) ) then print( "Menu or console opened!" ) end end[/lua] But it seems PlayerBindPress isn't called when those binds are used. Is there any other way to solve this?
I hear there's a drawing hook that does not get called when in the menu, but I forget which. It's hacky but it would work.
Oh yes, HUDPaint is only called when not in the menu. I forgot about that, thanks :).
Sorry, you need to Log In to post a reply to this thread.