Custom Main Menu

I was wondering how you would go about creating a custom pause/main menu for your gamemode. I saw that TheMaw did it and i didnt think it was possible. Anyone know how he did it?

It’s not really a custom main menu, just a huge panel over your screen, with buttons and stuff, you can’t override actual main menu from your gamemode.

How did he get rid of the usual? There is still transparency.

What gamemode? I don’t believe you.

I haven’t actually played it, so I may be wrong, but this is his most popular gamemode, I believe.

http://forum.facepunch.com/showthread.php?t=1013221

Yep, that would be the one. Not sure how he did it, apparently no one else knows either.

Could you post a screenshot of the menu?

Yea, he’s right, theres even an option to turn it back on.

Also, if you try and open up your console, it just acts as if you hit esc.

Probably blocked by http://wiki.garrysmod.com/page/GM/PlayerBindPress then.

Using HUD should paint or one such function I think you can prevent the drawing of parts of the menu system, I don’t quite remember but I ran across it by mistake a whole back but I know that if you override enough of the rendering system you can replace pretty much anything and everything.

If you were to use PlayerBindPress, what would the bind be that you would use to prevent the pause menu from showing up?

This is the best I’ve ever got, the menu may appear for a frame or so before disappearing.



hook.Add("Think", "escapeobob", function()
    if input.IsKeyDown(KEY_ESCAPE) then
        chat.AddText("escape pressed")
        RunConsoleCommand("cancelselect") -- Closes the mainmenu
    end
end)


There’s a chance PlayerBindPress will work when checking for the “cancelselect” bind, but I’m not using it for whatever reason which may include it not working.

He could have ran a command on the players to unbind the keys but there is no way to rebind them from lua afaik.

[lua]

MM_OVRW = true

concommand.Add(“tgmm”,function()
MM_OVRW = !MM_OVRW
end) – Use that in case of problems

hook.Add( “PreDrawHUD”, “MenuOverwrite”, function()
if (gui.IsGameUIVisible() and MM_OVRW) then
gui.HideGameUI()

    // Put your VGUI here

    end
end

end)

[/lua]