That is my bad, I didn't fully test it.
local convar = CreateConVar("server_mode", "0", FCVAR_ARCHIVE) -- Basically creates a console command that saves between maps
local whitelisted_groups = {} -- table for whitelisted groups
gameevent.Listen( "player_connect" ) -- Hooks into the engine's code if I'm not mistaken (I don't fully understand how it works)
hook.Add( "player_connect", "player_whitelist", function( data ) -- Lets us hook into the even we're listening too up there ^^
if convar:GetInt() == 1 then -- if server_mode is equal to 1
local steamid = data.networkid -- this is the steamid from the data we got from the hook
local userid = data.userid
local group = ULib.ucl.getUserInfoFromID(steamid) -- new ULib function to check user info by steamid
if not table.HasValue(whitelisted_groups, group.group) then -- checks if the group is not in your server whitelist
RunConsoleCommand("kickid", userid, "ENTER YOUR MESSAGE HERE")
end
end
end )
EDIT: Ignore me, now I'm doing something else wrong now.... I need to pay closer attention.
EDIT2: Should be fixed again.