Can I somehow hide the default ESC menu (to overwrite it later)?
Using GM/HUDShouldDraw with CHudMenu doesn't work at all.
I'm trying to avoid GM/Think and GM/PreDrawHUD hooks, since they are called too frequently and may create unneeded CPU/GPU load.
Can you provide the code you used?
1st chunk. As a result all of those elements are hidden, except for the menu.
local blocked = {
["CHudHealth"] = true,
["CHudBattery"] = true,
["CHudAmmo"] = true,
["CHudSecondaryAmmo"] = true,
["CHudPoisonDamageIndicator"] = true,
["CHudMenu"] = true,
["CHudChat"] = true
}
hook.Add("HUDShouldDraw", "COMDISABLEHUD", function(name)
return !blocked[name]
end)
2nd chunk. Hope to move it to KEY_ESCAPE later.
hook.Add ("PlayerButtonDown", "overridemenu", function (ply, butt)
if butt == KEY_F4 then
com_showmenu ()
end
end)
3nd chunk. Called every frame, causes default menu to appear for 1 frame, really uncool.
hook.Add( "PreDrawHUD", "hidemenu", function ()
if gui.IsGameUIVisible() then
gui.HideGameUI()
com_showmenu()
end
end)
hook.Add("HUDShouldDraw", "COMDISABLEHUD", function(name)
return !blocked[name]
end)
Do NOT do this, this will prevent any other HUDShouldDraw hooks from being called. You should do it like this:
hook.Add("HUDShouldDraw", "COMDISABLEHUD", function(name)
if blocked[name] then return false end
end)
Oooookay bud, I got it, gonna edit it right now. Any ideas about the main topic?
AFAIK the only way is to forcibly call `gui.HideGameUI()` in Think or something.
Also this is wrong:
I'm trying to avoid GM/Think and GM/PreDrawHUD hooks (used with gui.HideGameUI), since they are called too frequently and may create unneeded CPU/GPU load.
HIDShouldDraw is called way more than Think. On client Think is called once per frame, HUDShouldDraw is called tens or even hundreds of times per frame.
Not really, GM/HUDShouldDraw
This hook is called HUNDREDS of times per second (more than 5 times per frame on average).
Also I was talking about other function, GM/PreDrawHUD
Sorry, you need to Log In to post a reply to this thread.