Check if the player is in the esc menu

I want to stop drawing my custom chat when in there, what’s the best way to do this?

I’ve already tried an input.KeyDown with Think, this works, but what is the best way to get it back?

Normally when you draw it in HUDPaint it stops drawing, if you are not, you could in the HUDPaint do something like var = CurTime() And in your draw script check if the var differs a lot from the current time, so you know that you don’t draw it. A bit hacky but all that I can come up with xD

It’s a Panel and it’s in PANEL:Paint()…

Though I don’t understand how you want to check if we’re still in the esc menu :confused:

As you can see, “escape” is called when the player presses escape. It works when I type it in console, but nothing is printed when I do something like this:
[lua]hook.Add(“PlayerBindPress”, “PrintIfEscape”, function(ply, bind, press)
if(bind == “escape”)then print(“Escaping”); end;
if(bind == “toggleconsole”)then print(“toggleconsole”); end;

I think the answer lies in the function you wrote. I read **[Gamemode.PlayerBindPress](**- look at the differences in yours and the example at that page:
function GM:PlayerBindPress( ply, bind, pressed )
//To block more commands, you could add another line similar to the one below, just replace the command
if string.find( bind, “impulse 100” ) then return true end

The example searches for the string (to make sure you catch aliases) and also recommends searching for “pressed = TRUE” for toggle type commands to make sure you’re getting it on press and not unpress. (Of course you can then check for unpress to start drawing your chat again).

Just parent the panel to the hud. Should fix your problems.



Thanks mate, just what I was looking for.

Never knew that existed :open_mouth: