diff --git a/pac3_auto_ban/lua/autorun/server/pac3_auto_ban.lua b/pac3_auto_ban/lua/autorun/server/pac3_auto_ban.lua new file mode 100644 index 0000000..6ac2c2d --- /dev/null +++ b/pac3_auto_ban/lua/autorun/server/pac3_auto_ban.lua @@ -0,0 +1,26 @@ + +hook.Add("PlayerInitialSpawn", "edshot_pac3_auto_ban_connect", function(player, transition) + local userGroup = player:GetUserGroup() + + if (userGroup == "user_noaccess") then + RunConsoleCommand("pac_ban", player:SteamID()) + end +end) + +hook.Add("PlayerDisconnected", "edshot_pac3_auto_ban_disconnect", function(player) + local userGroup = player:GetUserGroup() + + if (userGroup == "user_noaccess") then + RunConsoleCommand("pac_unban", player:SteamID()) + end +end) + +hook.Add("ULibUserGroupChange", "edshot_pac3_auto_ban_groupchange", function(id, allows, denies, new_group, old_group) + if (new_group == "user_noaccess") then + RunConsoleCommand("pac_ban", id) + end + + if (old_group == "user_noaccess") then + RunConsoleCommand("pac_unban", id) + end +end)