Adding a whitelist is important if you're hosting a private server. By having a whitelist, you can still maintain privacy on your server without having to type in a password every time.
1. Open the File Manager
2. Navigate to /garrysmod/lua/autorun/server/
3. Right click and create a new file called allowedplayers.lua
4. Right click the file and click Edit
5. Enter the following 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)
6. Replace STEAMID1
and STEAMID2
with the Steam IDs of players you would like whitelisted.
7. Save the file and Restart the server