Home Garry's Mod Creating a Custom Admin Menu on a Garry's Mod Server

Creating a Custom Admin Menu on a Garry's Mod Server

Last updated on Feb 13, 2025

In this tutorial, you'll learn how to create a custom admin menu using Lua and VGUI on your Garry's Mod server via the VolticHost Game Panel. This menu will allow authorized administrators to quickly execute server commands—like restarting the server or accessing ban functions—with an intuitive graphical interface. 🚀


📌 Prerequisites


1️⃣ First Step - Uploading the Custom Admin Menu Script

  1. Log in to VolticHost Game Panel.

  2. Navigate to the File Manager from the main dashboard.

  3. Go to the /garrysmod/lua/autorun/client/ directory.

  4. Create a new file named admin_menu.lua.

  5. Open admin_menu.lua for editing and paste the following script:

    if CLIENT then
        -- Command to open the admin menu (only for admins)
        concommand.Add("open_adminmenu", function()
            if not LocalPlayer():IsAdmin() then
                chat.AddText(Color(255,0,0), "You are not authorized to use this menu!")
                return
            end
    
            local frame = vgui.Create("DFrame")
            frame:SetTitle("Admin Menu")
            frame:SetSize(300, 200)
            frame:Center()
            frame:MakePopup()
    
            local restartButton = vgui.Create("DButton", frame)
            restartButton:SetText("Restart Server")
            restartButton:Dock(TOP)
            restartButton:DockMargin(10, 10, 10, 5)
            restartButton.DoClick = function()
                RunConsoleCommand("restart")
                frame:Close()
            end
    
            local banButton = vgui.Create("DButton", frame)
            banButton:SetText("Open Ban Menu")
            banButton:Dock(TOP)
            banButton:DockMargin(10, 5, 10, 5)
            banButton.DoClick = function()
                RunConsoleCommand("open_custombanmenu")
                frame:Close()
            end
    
            local infoLabel = vgui.Create("DLabel", frame)
            infoLabel:SetText("Admin actions executed here.")
            infoLabel:Dock(BOTTOM)
            infoLabel:DockMargin(10, 5, 10, 10)
        end)
    end
    
  6. Save the file after editing.

  7. Restart your server from the VolticHost Game Panel to load the new client-side script.

Custom admin menu script uploaded and loaded successfully!


2️⃣ Next Step - Testing and Refining Your Admin Menu

  1. Join your server and open the in-game console.

  2. Type the command:

    open_adminmenu
    

    This should open the custom admin menu window.

  3. Verify that the menu displays the "Restart Server" and "Open Ban Menu" buttons along with a brief info label.

  4. Test each button:

    • Restart Server: Clicking this should execute the restart command.

    • Open Ban Menu: This should execute the command open_custombanmenu (ensure you have a custom ban menu script or command set up to handle this).

  5. If adjustments are needed (such as changing the layout, colors, or adding more commands), re-open admin_menu.lua in the File Manager, edit the script accordingly, and restart your server to apply the changes.

Custom admin menu tested and refined successfully!


🎉 Conclusion

You have now successfully created a custom admin menu on your Garry's Mod server using the VolticHost Game Panel! Enhance your server management by providing a user-friendly interface for executing critical admin commands. 🚀

For more assistance, contact VolticHost Support.