Applies to: Garry's Mod on the Gravel Host Panel · Time: about 10 minutes · Difficulty: Intermediate
Make your Garry's Mod server private with a short Lua script, so only the players you list can join and everyone else is turned away.
7656) of every player you want to allow.In the game panel, open the File Manager.
Go to /garrysmod/lua/autorun/server/.
Right click and create a new file called allowedplayers.lua.
Right click the file and click Edit.
Enter this code into the file:
local allowed = {
['STEAMID1'] = true,
['STEAMID2'] = true
}
hook.Add('CheckPassword', 'AllowList', function (sid64)
if not allowed[sid64] then return false, 'You are not whitelisted.' end
end)
Replace STEAMID1 and STEAMID2 with the SteamID64s of the players you want whitelisted. Add one line per player.
Save the file and Restart the server.
A whitelisted player can join. Anyone else sees "You are not whitelisted." when they try to connect.
The ID in the file is not their SteamID64, or it is missing its quotes. Use the 17 digit number that starts with 7656, keep the format ['76561198000000000'] = true,, then restart the server.
Still stuck? Our team is on Discord, or open a ticket from the Billing Panel.