Home Garry's Mod Setting Up a Server Whitelist on a Garry's Mod Server

Setting Up a Server Whitelist on a Garry's Mod Server

Last updated on Feb 13, 2025

In this tutorial, you'll learn how to set up a server whitelist on your Garry's Mod server using a custom Lua script and the VolticHost Game Panel. This method allows you to restrict access to only approved players by their SteamIDs, ensuring a more secure and controlled gaming environment. 🚀


📌 Prerequisites

  • A Garry's Mod server purchased at VolticHost.com

  • Access to the VolticHost Game Panel

  • Basic knowledge of Lua scripting and file management

  • A list of SteamIDs for the players you wish to whitelist


1️⃣ First Step - Creating the Whitelist 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/server/ directory.

  4. Create a new file named whitelist.lua in this directory.

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

    if SERVER then
        local whitelist = {
            ["STEAM_0:1:12345678"] = true,
            ["STEAM_0:1:87654321"] = true
        }
        
        hook.Add("PlayerInitialSpawn", "WhitelistCheck", function(ply)
            if not whitelist[ply:SteamID()] then
                ply:Kick("You are not whitelisted on this server.")
            end
        end)
    end
    
  6. Replace the example SteamIDs with the actual SteamIDs of the players you want to allow.

  7. Save the file after editing.

Whitelist script created and saved successfully!


2️⃣ Next Step - Activating the Whitelist

  1. Restart your server from the VolticHost Game Panel to load the new Lua script.

  2. Once the server is running, only the players with the specified SteamIDs will be able to join.

  3. Test the setup by attempting to join the server with a SteamID not on the whitelist to ensure they are kicked.

Whitelist activated and tested successfully!


🎉 Conclusion

You have now successfully set up a server whitelist on your Garry's Mod server using a custom Lua script via the VolticHost Game Panel! Enjoy a more secure and controlled gaming environment by ensuring only approved players can join. 🚀

For more assistance, contact VolticHost Support.