By the way, in order to make a custom MainMenuButtonsGui, you need to do this before the new GuiControl line:
MainMenuButtonsGui.delete();
I'm not 100% sure but you might need to move the GUI to a .cs file in order to do that.
No, don't do this. You should not be re-creating the entire Main Menu GUI. Here's everything that your
MainMenuButtonsGui.gui file should have:
new GuiBitmapButtonCtrl(CreateAClass) {
profile = "BlockButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "4 157";
extent = "102 41";
minExtent = "8 2";
enabled = "1";
visible = "1";
clipToParent = "1";
text = "Modern Addons";
command = "canvas.pushDialog(ModernAddonsPack);";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button2";
lockAspectRatio = "0";
alignLeft = "0";
alignTop = "0";
overflowImage = "0";
mKeepCached = "0";
mColor = "255 255 255 255";
};
MainMenuButtonsGui.add(CreateAClass);
Note the name of the object: CreateAClass
Note the new command field that I added: This is what causes your GUI to open when you push the button.
Note the last line: This adds your button to the existing GUI.