From 6c3982027221f829e3e8d7e03f205f3326aa80e1 Mon Sep 17 00:00:00 2001 From: Bitl Date: Tue, 2 Aug 2022 13:51:21 -0700 Subject: [PATCH] add whitelist addon --- AddonLoader.lua | 2 +- ServerWhitelist.lua | 69 +++++++++++++++++++++++++++ changelog.txt | 10 ++++ scripts/batch/github_sync.bat | 1 + scripts/launcher/splashes-special.txt | 3 +- 5 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 ServerWhitelist.lua diff --git a/AddonLoader.lua b/AddonLoader.lua index ea2908b..53891a1 100644 --- a/AddonLoader.lua +++ b/AddonLoader.lua @@ -1,6 +1,6 @@ -- put script names here -Addons = {"ClientNamePrinter", "ShadersCompatibility", "ServerClock"} +Addons = {"ClientNamePrinter", "ShadersCompatibility", "ServerClock", "ServerWhitelist"} -- DONT EDIT ANYTHING ELSE BELOW diff --git a/ServerWhitelist.lua b/ServerWhitelist.lua new file mode 100644 index 0000000..3d76c70 --- /dev/null +++ b/ServerWhitelist.lua @@ -0,0 +1,69 @@ +local this = {} + +--https://www.tutorialspoint.com/how-to-search-for-an-item-in-a-lua-list +function Set(list) + local set = {} + for _, l in ipairs(list) do set[l] = true end + return set +end + +-- DONT EDIT ANYTHING ELSE ABOVE + +-- add player tripcodes here in quotes sepertaed by commas +local tripcodeList = Set {} +-- enable this to trigger the whitelist +local enabled = false + +-- DONT EDIT ANYTHING ELSE BELOW + +function this:Name() + return "Server Whitelist" +end + +-- executes before the game starts (server, solo, studio) +-- arguments: Script - returns the script type name (Server, Solo, Studio), Client - returns the Client name. +function this:PreInit(Script, Client) + if (Script ~= "Server") then + enabled = false + end +end + +-- executes after a player joins (server) +-- arguments: Player - the Player joining +function this:OnPlayerAdded(Player) + if (enabled == true) then + local hasTripcode = false + + for _,newVal in pairs(Player:children()) do + if (newVal.Name == "Tripcode") then + if (newVal.Value ~= "") then + hasTripcode = true + end + end + end + + if (hasTripcode and tripcodeList[Player.Tripcode.Value]) then + print("Player '" .. Player.Name .. "' is in whitelist!") + else + print("Player '" .. Player.Name .. "' not in whitelist. Kicking.") + + Server = game:GetService("NetworkServer") + for _,Child in pairs(Server:children()) do + name = "ServerReplicator|"..Player.Name.."|"..Player.userId.."|"..Player.AnonymousIdentifier.Value + if (Server:findFirstChild(name) ~= nil and Child.Name == name) then + Child:CloseConnection() + print("Player '" .. Player.Name .. "' Kicked. Reason: Not in whitelist") + end + end + end + end +end + +-- DO NOT REMOVE THIS. this is required to load this addon into the game. + +function AddModule(t) + print("AddonLoader: Adding " .. this:Name()) + table.insert(t, this) +end + +_G.CSScript_AddModule=AddModule \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index 2d8b91e..0e21c33 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,14 @@ +1.3 Snapshot v22.8245.30338.1 +Enhancements: +- The initial file list for the Mod Package Creator now checks if all lines are created on the file. +- The initial file list now generates when launching the SDK if one is not generated already. +- Added the -nofilelist command line option to disable the launcher's file list creation on slower computers (will make the Mod Package Creator basically unusable on first load) + +---------------------------------------------------------------------------- 1.3 Snapshot v22.8245.27180.1 +Note: +- If you want to use the new Mod Package Creator for the first time, make sure to use a clean, unmodified Novetus install. Any installed mods before this update will not show up in the Mod Package Creator if you install this update on a previous Novetus version. + Enhancements: - Re-implemented the progress bar/status text to the Asset Fixer. - The Asset Fixer and Legacy Place Converter will now show errors when loading a binary format place/model. diff --git a/scripts/batch/github_sync.bat b/scripts/batch/github_sync.bat index c1238ce..46a1622 100644 --- a/scripts/batch/github_sync.bat +++ b/scripts/batch/github_sync.bat @@ -145,5 +145,6 @@ XCOPY "%cd%\Novetus\addons\Addon_Template.lua" "%dest%" /y XCOPY "%cd%\Novetus\addons\ClientNamePrinter.lua" "%dest%" /y XCOPY "%cd%\Novetus\addons\ShadersCompatibility.lua" "%dest%" /y XCOPY "%cd%\Novetus\addons\ServerClock.lua" "%dest%" /y +XCOPY "%cd%\Novetus\addons\ServerWhitelist.lua" "%dest%" /y XCOPY "%cd%\Novetus\addons\core\AddonLoader.lua" "%dest%" /y if %debug%==1 pause \ No newline at end of file diff --git a/scripts/launcher/splashes-special.txt b/scripts/launcher/splashes-special.txt index 6cbe31e..244e55b 100644 --- a/scripts/launcher/splashes-special.txt +++ b/scripts/launcher/splashes-special.txt @@ -13,4 +13,5 @@ Adventure Awaits...|The first trailer used to promote Roblox to the public was%n Welcome to %version%!|Hi!|11/11 Merry Christmas!|...and a happy new year!|12/24-12/25 Happy New Year!|Have a happy %nextyear%!|12/31 -Happy Out-of-Touch Thursday!|You're out of touch, I'm out of time.%newline%But I'm out of my head when you're not around!|Thursday \ No newline at end of file +Happy Out-of-Touch Thursday!|You're out of touch, I'm out of time.%newline%But I'm out of my head when you're not around!|Thursday +Today is Friday in California.|HUH?%newline%%newline%SHOOT!|Friday \ No newline at end of file