add IsEnabled novetus api function. fix whitelist 2011 crash

This commit is contained in:
Bitl 2022-08-08 16:56:41 -07:00
parent c564225766
commit 48c9d2bcb2
8 changed files with 151 additions and 149 deletions

View File

@ -1,10 +1,12 @@
-- put script names here -- put script names here
Addons = {"ClientNamePrinter", "ShadersCompatibility", "ServerClock", "ServerWhitelist"} Addons = {"Utils", "ShadersCompatibility", "ServerWhitelist"}
-- DONT EDIT ANYTHING ELSE BELOW -- DONT EDIT ANYTHING ELSE BELOW
local CoreScriptName = "AddonLoader" CoreScriptName = "AddonLoader"
ParentClient = "2009E"
ParentFunctionScript = "Server"
Scripts = {} Scripts = {}
@ -33,73 +35,116 @@ for i,v in pairs(Scripts) do
end end
function PreInit(Script, Client) function PreInit(Script, Client)
ParentClient = Client
ParentFunctionScript = Script
for i,v in pairs(Modules) do for i,v in pairs(Modules) do
local success, response = pcall(function() v:PreInit(Script, Client) end) local enabled = true
if (not success and not string.find(response, CoreScriptName)) then local s, r = pcall(function() enabled = v:IsEnabled(Script, Client) end)
print("AddonLoader: Failed to call PreInit: " .. response)
if (enabled) then
local success, response = pcall(function() v:PreInit(Script, Client) end)
if (not success and not string.find(response, CoreScriptName)) then
print("AddonLoader: Failed to call PreInit: " .. response)
end
end end
end end
end end
function PostInit() function PostInit()
for i,v in pairs(Modules) do for i,v in pairs(Modules) do
local success, response = pcall(function() v:PostInit() end) local enabled = true
if (not success and not string.find(response, CoreScriptName)) then local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
print("AddonLoader: Failed to call PostInit: " .. response)
if (enabled) then
local success, response = pcall(function() v:PostInit() end)
if (not success and not string.find(response, CoreScriptName)) then
print("AddonLoader: Failed to call PostInit: " .. response)
end
end end
end end
end end
function Update() function Update()
for i,v in pairs(Modules) do for i,v in pairs(Modules) do
local success, response = pcall(function() v:Update() end) local enabled = true
if (not success and not string.find(response, CoreScriptName)) then local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
print("AddonLoader: Failed to call Update: " .. response)
if (enabled) then
local success, response = pcall(function() v:Update() end)
if (not success and not string.find(response, CoreScriptName)) then
print("AddonLoader: Failed to call Update: " .. response)
end
end end
end end
end end
function OnLoadCharacter(Player, Appearance) function OnLoadCharacter(Player, Appearance)
for i,v in pairs(Modules) do for i,v in pairs(Modules) do
local success, response = pcall(function() v:OnLoadCharacter(Player, Appearance) end) local enabled = true
if (not success and not string.find(response, CoreScriptName)) then local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
print("AddonLoader: Failed to call OnLoadCharacter: " .. response)
if (enabled) then
local success, response = pcall(function() v:OnLoadCharacter(Player, Appearance) end)
if (not success and not string.find(response, CoreScriptName)) then
print("AddonLoader: Failed to call OnLoadCharacter: " .. response)
end
end end
end end
end end
function OnPlayerAdded(Player) function OnPlayerAdded(Player)
for i,v in pairs(Modules) do for i,v in pairs(Modules) do
local success, response = pcall(function() v:OnPlayerAdded(Player) end) local enabled = true
if (not success and not string.find(response, CoreScriptName)) then local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
print("AddonLoader: Failed to call OnPlayerAdded: " .. response)
if (enabled) then
local success, response = pcall(function() v:OnPlayerAdded(Player) end)
if (not success and not string.find(response, CoreScriptName)) then
print("AddonLoader: Failed to call OnPlayerAdded: " .. response)
end
end end
end end
end end
function OnPlayerRemoved(Player) function OnPlayerRemoved(Player)
for i,v in pairs(Modules) do for i,v in pairs(Modules) do
local success, response = pcall(function() v:OnPlayerRemoved(Player) end) local enabled = true
if (not success and not string.find(response, CoreScriptName)) then local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
print("AddonLoader: Failed to call OnPlayerRemoved: " .. response)
if (enabled) then
local success, response = pcall(function() v:OnPlayerRemoved(Player) end)
if (not success and not string.find(response, CoreScriptName)) then
print("AddonLoader: Failed to call OnPlayerRemoved: " .. response)
end
end end
end end
end end
function OnPlayerKicked(Player, Reason) function OnPlayerKicked(Player, Reason)
for i,v in pairs(Modules) do for i,v in pairs(Modules) do
local success, response = pcall(function() v:OnPlayerKicked(Player, Reason) end) local enabled = true
if (not success and not string.find(response, CoreScriptName)) then local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
print("AddonLoader: Failed to call OnPlayerKicked: " .. response)
if (enabled) then
local success, response = pcall(function() v:OnPlayerKicked(Player, Reason) end)
if (not success and not string.find(response, CoreScriptName)) then
print("AddonLoader: Failed to call OnPlayerKicked: " .. response)
end
end end
end end
end end
function OnPrePlayerKicked(Player, Reason) function OnPrePlayerKicked(Player, Reason)
for i,v in pairs(Modules) do for i,v in pairs(Modules) do
local success, response = pcall(function() v:OnPrePlayerKicked(Player, Reason) end) local enabled = true
if (not success and not string.find(response, CoreScriptName)) then local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
print("AddonLoader: Failed to call OnPrePlayerKicked: " .. response)
if (enabled) then
local success, response = pcall(function() v:OnPrePlayerKicked(Player, Reason) end)
if (not success and not string.find(response, CoreScriptName)) then
print("AddonLoader: Failed to call OnPrePlayerKicked: " .. response)
end
end end
end end
end end

View File

@ -4,6 +4,12 @@ function this:Name()
return "Template" return "Template"
end end
-- checks if the script is enabled based on Script, Client, or some other reason
-- arguments: Script - returns the script type name (Server, Solo, Studio), Client - returns the Client name.
function this:IsEnabled(Script, Client)
return true
end
-- executes before the game starts (server, solo, studio) -- executes before the game starts (server, solo, studio)
-- arguments: Script - returns the script type name (Server, Solo, Studio), Client - returns the Client name. -- arguments: Script - returns the script type name (Server, Solo, Studio), Client - returns the Client name.
function this:PreInit(Script, Client) function this:PreInit(Script, Client)

View File

@ -1,36 +0,0 @@
local this = {}
local ScriptName = "N/A"
function this:Name()
return "Server Clock (Time Since Started)"
end
function this:PreInit(Script, Client)
ScriptName = Script
end
function this:PostInit()
if (ScriptName == "Server") then
local ver = Instance.new("IntValue",game.Lighting)
ver.Name = "ServerTicks"
ver.Value = 0
end
end
-- executes every 0.1 seconds. (server, solo, studio)
-- arguments: none
function this:Update()
-- we already wait 0.1 seconds
if (ScriptName == "Server") then
game.Lighting.ServerTicks.Value = game.Lighting.ServerTicks.Value + 1
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

View File

@ -12,7 +12,7 @@ end
-- add player tripcodes here in quotes seperated by commas -- add player tripcodes here in quotes seperated by commas
local tripcodeList = Set {} local tripcodeList = Set {}
-- enable this to trigger the whitelist -- enable this to trigger the whitelist
local enabled = false local whitelistEnabled = true
-- DONT EDIT ANYTHING ELSE BELOW -- DONT EDIT ANYTHING ELSE BELOW
@ -20,18 +20,16 @@ function this:Name()
return "Server Whitelist" return "Server Whitelist"
end end
-- executes before the game starts (server, solo, studio) function this:IsEnabled(Script, Client)
-- arguments: Script - returns the script type name (Server, Solo, Studio), Client - returns the Client name. if (Script == "Server") then
function this:PreInit(Script, Client) return true
if (Script ~= "Server") then else
enabled = false return false
end end
end end
-- executes after a player joins (server)
-- arguments: Player - the Player joining
function this:OnPlayerAdded(Player) function this:OnPlayerAdded(Player)
if (enabled == true) then if (whitelistEnabled == true) then
local hasTripcode = false local hasTripcode = false
for _,newVal in pairs(Player:children()) do for _,newVal in pairs(Player:children()) do
@ -51,16 +49,14 @@ function this:OnPlayerAdded(Player)
for _,Child in pairs(Server:children()) do for _,Child in pairs(Server:children()) do
name = "ServerReplicator|"..Player.Name.."|"..Player.userId.."|"..Player.AnonymousIdentifier.Value name = "ServerReplicator|"..Player.Name.."|"..Player.userId.."|"..Player.AnonymousIdentifier.Value
if (Server:findFirstChild(name) ~= nil and Child.Name == name) then if (Server:findFirstChild(name) ~= nil and Child.Name == name) then
Child:CloseConnection() --delayed to fix 2011 client crash
print("Player '" .. Player.Name .. "' Kicked. Reason: Not in whitelist") delay(0.3, function() Child:CloseConnection() print("Player '" .. Player.Name .. "' Kicked. Reason: Not in whitelist") end)
end end
end end
end end
end end
end end
-- DO NOT REMOVE THIS. this is required to load this addon into the game.
function AddModule(t) function AddModule(t)
print("AddonLoader: Adding " .. this:Name()) print("AddonLoader: Adding " .. this:Name())
table.insert(t, this) table.insert(t, this)

View File

@ -1,103 +1,89 @@
-- allows 2007M, 2006S, 2007E, and 2009E users to join Shaders/HD servers, and vice versa -- allows 2007M, 2006S, 2007E, and 2009E users to join Shaders/HD servers, and vice versa
local this = {} local this = {}
local ClientName = "N/A"
function this:Name() function this:Name()
return "Shader Client MP Compatibility" return "Shader Client MP Compatibility"
end end
-- executes before the game starts (server, solo, studio) function this:IsEnabled(Script, Client)
-- arguments: Script - returns the script type name (Server, Solo, Studio), Client - returns the Client name.
function this:PreInit(Script, Client)
ClientName = Client
end
function IsShaderSupportingClient()
-- hate this so much -- hate this so much
if (ClientName == "2007E" or ClientName == "2007M" or ClientName == "2006S" or ClientName == "2007E-Shaders" or ClientName == "2007M-Shaders" or ClientName == "2006S-Shaders" or ClientName == "2009E" or ClientName == "2009E-HD") then if (Client == "2007E" or Client == "2007M" or Client == "2006S" or Client == "2007E-Shaders" or Client == "2007M-Shaders" or Client == "2006S-Shaders" or Client == "2009E" or Client == "2009E-HD") then
return true return true
else
return false
end end
end end
-- executes before a player gets kicked (server)
-- arguments: Player - the Player getting kicked, Reason - the reason the player got kicked
function this:OnPrePlayerKicked(Player, Reason) function this:OnPrePlayerKicked(Player, Reason)
if (game.Lighting:findFirstChild("SkipSecurity") ~= nil) then if (game.Lighting:findFirstChild("SkipSecurity") ~= nil) then
do return end do return end
end end
if (IsShaderSupportingClient()) then invalidSecurityVals = 0
invalidSecurityVals = 0
for _,newVal in pairs(Player.Security:children()) do
if (newVal.Name == "ClientEXEMD5") then
if (newVal.Value ~= game.Lighting.Security.ClientEXEMD5.Value or newVal.Value == "") then
invalidSecurityVals = invalidSecurityVals + 1
end
end
if (newVal.Name == "LauncherMD5") then
if (newVal.Value ~= game.Lighting.Security.LauncherMD5.Value or newVal.Value == "") then
invalidSecurityVals = invalidSecurityVals + 1
end
end
if (newVal.Name == "ClientScriptMD5") then
if (newVal.Value ~= game.Lighting.Security.ClientScriptMD5.Value or newVal.Value == "") then
invalidSecurityVals = invalidSecurityVals + 1
end
end
end
if (invalidSecurityVals < 3) then
print(Player.Name .. " has "..invalidSecurityVals.." invalid security values! Verifying...")
validLauncher = false
hasTripcode = false
securityValues = 0
for _,newVal in pairs(Player.Security:children()) do for _,newVal in pairs(Player.Security:children()) do
if (newVal.Name == "ClientEXEMD5") then
if (newVal.Value ~= game.Lighting.Security.ClientEXEMD5.Value or newVal.Value == "") then
invalidSecurityVals = invalidSecurityVals + 1
end
end
if (newVal.Name == "LauncherMD5") then if (newVal.Name == "LauncherMD5") then
if (newVal.Value ~= game.Lighting.Security.LauncherMD5.Value or newVal.Value == "") then if (newVal.Value == game.Lighting.Security.LauncherMD5.Value) then
invalidSecurityVals = invalidSecurityVals + 1 validLauncher = true
end end
end end
if (newVal.Name == "ClientScriptMD5") then securityValues = securityValues + 1
if (newVal.Value ~= game.Lighting.Security.ClientScriptMD5.Value or newVal.Value == "") then end
invalidSecurityVals = invalidSecurityVals + 1
for _,newVal in pairs(Player:children()) do
if (newVal.Name == "Tripcode") then
if (newVal.Value ~= "") then
hasTripcode = true
end end
end end
end end
if (invalidSecurityVals < 3) then if (validLauncher == true and hasTripcode == true and securityValues == 3) then
print(Player.Name .. " has "..invalidSecurityVals.." invalid security values! Verifying...") print(Player.Name .. " is using a valid modified client!")
validLauncher = false local ver = Instance.new("StringValue",game.Lighting)
hasTripcode = false ver.Name = "SkipSecurity"
securityValues = 0 local tempTag = Instance.new("StringValue",ver)
tempTag.Name = "Temp"
for _,newVal in pairs(Player.Security:children()) do
if (newVal.Name == "LauncherMD5") then
if (newVal.Value == game.Lighting.Security.LauncherMD5.Value) then
validLauncher = true
end
end
securityValues = securityValues + 1
end
for _,newVal in pairs(Player:children()) do
if (newVal.Name == "Tripcode") then
if (newVal.Value ~= "") then
hasTripcode = true
end
end
end
if (validLauncher == true and hasTripcode == true and securityValues == 3) then
print(Player.Name .. " is using a valid modified client!")
local ver = Instance.new("StringValue",game.Lighting)
ver.Name = "SkipSecurity"
local tempTag = Instance.new("StringValue",ver)
tempTag.Name = "Temp"
else
print(Player.Name .. " is using an invalid modified client! Kicking...")
end
else else
print(Player.Name .. " is using an invalid modified client! Kicking...") print(Player.Name .. " is using an invalid modified client! Kicking...")
end end
else
print(Player.Name .. " is using an invalid modified client! Kicking...")
end end
end end
-- executes after a character loads (server, solo, studio)
-- arguments: Player - Player getting a character loaded, Appearance - The object containing the appearance values
-- notes: in play solo, you may have to respawn once to see any print outputs.
function this:OnLoadCharacter(Player, Appearance) function this:OnLoadCharacter(Player, Appearance)
if (IsShaderSupportingClient()) then if (game.Lighting:findFirstChild("SkipSecurity") ~= nil) then
if (game.Lighting:findFirstChild("SkipSecurity") ~= nil) then if (game.Lighting.SkipSecurity:findFirstChild("Temp") ~= nil) then
if (game.Lighting.SkipSecurity:findFirstChild("Temp") ~= nil) then game.Lighting.SkipSecurity:remove()
game.Lighting.SkipSecurity:remove()
end
end end
end end
end end

View File

@ -1,9 +1,15 @@
--adds a StringValue that lists the client's version.
local this = {} local this = {}
function this:Name() function this:Name()
return "Client Name and Script Printer" return "Novetus Utilities (Client Name Printer and Script Name Printer)"
end
function this:IsEnabled(Script, Client)
if (Script ~= "Studio") then
return true
else
return false
end
end end
function this:PreInit(Script, Client) function this:PreInit(Script, Client)

View File

@ -19,8 +19,7 @@ Enhancements:
- The old -script command line argument in NovetusCMD and the ClientScript variable %addonscriptpath% have both been removed to support this. - The old -script command line argument in NovetusCMD and the ClientScript variable %addonscriptpath% have both been removed to support this.
- Look in the addons/Addon_Template.lua file for more info on how to create your addon script! - Look in the addons/Addon_Template.lua file for more info on how to create your addon script!
- Addon Scripts that are pre-installed and loaded: - Addon Scripts that are pre-installed and loaded:
- ClientNamePrinter - Prints the name of the currently running client in a Lighting object. Good for determining client version in games. - Utils - Prints the name of the currently running client and script in a Lighting object.
- ServerClock - Prints the server ticks in a Lighting object. Good for creating in-game events.
- ShadersCompatibility - Allows 2007E, 2007M, 2006S and 2009E to connect to servers running alternate versions (Shaders, HD, etc) and vice versa. - ShadersCompatibility - Allows 2007E, 2007M, 2006S and 2009E to connect to servers running alternate versions (Shaders, HD, etc) and vice versa.
- ServerWhitelist - Makes it so users' tripcodes have to be added to a whitelist before joining a server. Disabled by default. - ServerWhitelist - Makes it so users' tripcodes have to be added to a whitelist before joining a server. Disabled by default.
- 2008M no longer uses OpenGL Legacy as the default graphics mode. - 2008M no longer uses OpenGL Legacy as the default graphics mode.
@ -48,6 +47,7 @@ Fixes:
- Fixed 2010L server joining not working. - Fixed 2010L server joining not working.
- Fixed 2007E based clients not loading all customized parts properly. - Fixed 2007E based clients not loading all customized parts properly.
- Fixed master server pings making the launcher/CMD unresponsive. - Fixed master server pings making the launcher/CMD unresponsive.
- Rise of the Killbots: Fixed bullets not disappearing after a specified amount of time, causing soem optimization issues (https://itch.io/t/2277693/issues-with-bullets-in-rise-of-killbots)
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
1.3 Snapshot v22.8253.19867.1 1.3 Snapshot v22.8253.19867.1
Enhancements: Enhancements:

View File

@ -143,9 +143,8 @@ XCOPY "%cd%\Novetus\LICENSE.txt" "%dest%\LICENSE" /y
XCOPY "%cd%\Novetus\LICENSE-RESHADE.txt" "%dest%\LICENSE-RESHADE" /y XCOPY "%cd%\Novetus\LICENSE-RESHADE.txt" "%dest%\LICENSE-RESHADE" /y
XCOPY "%cd%\Novetus\README-AND-CREDITS.TXT" "%dest%" /y XCOPY "%cd%\Novetus\README-AND-CREDITS.TXT" "%dest%" /y
XCOPY "%cd%\Novetus\addons\Addon_Template.lua" "%dest%" /y XCOPY "%cd%\Novetus\addons\Addon_Template.lua" "%dest%" /y
XCOPY "%cd%\Novetus\addons\ClientNamePrinter.lua" "%dest%" /y XCOPY "%cd%\Novetus\addons\Utils.lua" "%dest%" /y
XCOPY "%cd%\Novetus\addons\ShadersCompatibility.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\ServerWhitelist.lua" "%dest%" /y
XCOPY "%cd%\Novetus\addons\core\AddonLoader.lua" "%dest%" /y XCOPY "%cd%\Novetus\addons\core\AddonLoader.lua" "%dest%" /y
if %debug%==1 pause if %debug%==1 pause