Whitelist Addon?

Looking for a working Whitelist addon to use instead of using sv_password.

Had found this (but no download exist anymore):

Would be nice to even have an sql version with a nice command like !whitelist <entersteamid> and maybe an in game menu to view who has been added on the whitelist.

Main purpose I’m looking for this, is for private server usage for my VIP members.


Write one, it’s not really hard to check for steamID within’ a list on player connection

I dont know how :frowning:

I just wrote this up, hoping you could change it your liking, but maybe you can’t… Hopefully you’ll try, and learn.

It’s not SQL, just stored in a .txt file, and has no in-game menu, it is all serverside. Chat commands for !whitelist theirsteamid and !unwhitelist theirsteamid

It’s super basic and I haven’t even tested it but it should work.

Put this in lua/autorun/server/cockblocker.lua (call it whatever you want)
[lua]–Cockblocker 2014 ____________________Whiterabbit

–In game use the chat commands !whitelist theirsteamid and !unwhitelist theirsteamid

local FailureMessage = “You are not on the whitelist”
local StorageFile = “cockblocker.txt”
local SteamIDs = { [“steam_0:1:1234”]=true } --the default setup, put your steamid here IN LOWERCASE

–Save the list of steam ids
local function SaveSteamIDs()
file.Write( StorageFile, util.TableToJSON(SteamIDs) )

–Make sure we have a file to load, even if its just an empty table
local function MakeSureFileExists()
if not file.Exists(StorageFile,“DATA”) then

–Read stored ids from file
local function LoadStoredSteamIDs()
local String = file.Read(StorageFile,“DATA”)
SteamIDs = util.JSONToTable(String)

–The actual checking function
local function WhitelistCheck(Steam64,IP,SVPass,CLPass,Name)
local SteamID = util.SteamIDFrom64(Steam64)
if not SteamIDs[SteamID:lower()] then
return false,FailureMessage
return true

–For adding and removing ids
local function AddID(id)
SteamIDs[tostring(id):lower()] = true
local function RemoveID(id)
SteamIDs[tostring(id):lower()] = nil

–The chat command
local function WhitelistChatCommand(player,text)
if string.StartWith(text,"!whitelist “) then
local Param = tostring( string.sub(text,12) ):lower()
elseif string.StartWith(text,”!unwhitelist ") then
local Param = tostring( string.sub(text,14) ):lower()

–Install connection and chat hooks
local function InstallHook()
hook.Add(“CheckPassword”, “Cockblocker Whitelist Check”, WhitelistCheck)
hook.Add(“PlayerSay”, “Cockblocker Chatcommand”, WhitelistChatCommand)

–Load all that shit
local function Load()

thanks, will test it in just a sec!

I just made two small changes to the code, added “DATA” to the file.Read, and :lower() to the steamid check.

Getting this error:

Why don’t you try something yourself instead of begging others to spoon feed you?

Start here: http://wiki.garrysmod.com/page/GM/CheckPassword

also does that text file get auto generated? if so where does it end up going?

the second argument should be “DATA”

Lua can only ever create files within your data folder.

Thank you! Will try that now.

[editline]27th August 2014[/editline]

Works like a charm! Thank you so much!

I wrote a really crude workshop addon sometime ago called GroupChecker that allows you to use a private Steam group to allow members to join your server.
It might have a few bugs, but it shouldn’t be too hard for you to decompile it and fix them yourself. It’s just a single file.