add IsEnabled novetus api function. fix whitelist 2011 crash
This commit is contained in:
parent
c564225766
commit
48c9d2bcb2
|
|
@ -1,10 +1,12 @@
|
|||
-- put script names here
|
||||
|
||||
Addons = {"ClientNamePrinter", "ShadersCompatibility", "ServerClock", "ServerWhitelist"}
|
||||
Addons = {"Utils", "ShadersCompatibility", "ServerWhitelist"}
|
||||
|
||||
-- DONT EDIT ANYTHING ELSE BELOW
|
||||
|
||||
local CoreScriptName = "AddonLoader"
|
||||
CoreScriptName = "AddonLoader"
|
||||
ParentClient = "2009E"
|
||||
ParentFunctionScript = "Server"
|
||||
|
||||
Scripts = {}
|
||||
|
||||
|
|
@ -33,73 +35,116 @@ for i,v in pairs(Scripts) do
|
|||
end
|
||||
|
||||
function PreInit(Script, Client)
|
||||
ParentClient = Client
|
||||
ParentFunctionScript = Script
|
||||
|
||||
for i,v in pairs(Modules) do
|
||||
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)
|
||||
local enabled = true
|
||||
local s, r = pcall(function() enabled = v:IsEnabled(Script, Client) end)
|
||||
|
||||
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
|
||||
|
||||
function PostInit()
|
||||
for i,v in pairs(Modules) do
|
||||
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)
|
||||
local enabled = true
|
||||
local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
|
||||
|
||||
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
|
||||
|
||||
function Update()
|
||||
for i,v in pairs(Modules) do
|
||||
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)
|
||||
local enabled = true
|
||||
local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
|
||||
|
||||
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
|
||||
|
||||
function OnLoadCharacter(Player, Appearance)
|
||||
for i,v in pairs(Modules) do
|
||||
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)
|
||||
local enabled = true
|
||||
local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
|
||||
|
||||
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
|
||||
|
||||
function OnPlayerAdded(Player)
|
||||
for i,v in pairs(Modules) do
|
||||
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)
|
||||
local enabled = true
|
||||
local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
|
||||
|
||||
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
|
||||
|
||||
function OnPlayerRemoved(Player)
|
||||
for i,v in pairs(Modules) do
|
||||
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)
|
||||
local enabled = true
|
||||
local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
|
||||
|
||||
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
|
||||
|
||||
function OnPlayerKicked(Player, Reason)
|
||||
for i,v in pairs(Modules) do
|
||||
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)
|
||||
local enabled = true
|
||||
local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
|
||||
|
||||
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
|
||||
|
||||
function OnPrePlayerKicked(Player, Reason)
|
||||
for i,v in pairs(Modules) do
|
||||
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)
|
||||
local enabled = true
|
||||
local s, r = pcall(function() enabled = v:IsEnabled(ParentFunctionScript, ParentClient) end)
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -4,6 +4,12 @@ function this:Name()
|
|||
return "Template"
|
||||
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)
|
||||
-- arguments: Script - returns the script type name (Server, Solo, Studio), Client - returns the Client name.
|
||||
function this:PreInit(Script, Client)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -12,7 +12,7 @@ end
|
|||
-- add player tripcodes here in quotes seperated by commas
|
||||
local tripcodeList = Set {}
|
||||
-- enable this to trigger the whitelist
|
||||
local enabled = false
|
||||
local whitelistEnabled = true
|
||||
|
||||
-- DONT EDIT ANYTHING ELSE BELOW
|
||||
|
||||
|
|
@ -20,18 +20,16 @@ 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
|
||||
function this:IsEnabled(Script, Client)
|
||||
if (Script == "Server") then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- executes after a player joins (server)
|
||||
-- arguments: Player - the Player joining
|
||||
function this:OnPlayerAdded(Player)
|
||||
if (enabled == true) then
|
||||
if (whitelistEnabled == true) then
|
||||
local hasTripcode = false
|
||||
|
||||
for _,newVal in pairs(Player:children()) do
|
||||
|
|
@ -51,16 +49,14 @@ function this:OnPlayerAdded(Player)
|
|||
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")
|
||||
--delayed to fix 2011 client crash
|
||||
delay(0.3, function() Child:CloseConnection() print("Player '" .. Player.Name .. "' Kicked. Reason: Not in whitelist") end)
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -1,103 +1,89 @@
|
|||
-- allows 2007M, 2006S, 2007E, and 2009E users to join Shaders/HD servers, and vice versa
|
||||
|
||||
local this = {}
|
||||
local ClientName = "N/A"
|
||||
|
||||
function this:Name()
|
||||
return "Shader Client MP Compatibility"
|
||||
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)
|
||||
ClientName = Client
|
||||
end
|
||||
|
||||
function IsShaderSupportingClient()
|
||||
function this:IsEnabled(Script, Client)
|
||||
-- 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
|
||||
else
|
||||
return false
|
||||
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)
|
||||
if (game.Lighting:findFirstChild("SkipSecurity") ~= nil) then
|
||||
do return 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
|
||||
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
|
||||
if (newVal.Value == game.Lighting.Security.LauncherMD5.Value) then
|
||||
validLauncher = true
|
||||
end
|
||||
end
|
||||
|
||||
if (newVal.Name == "ClientScriptMD5") then
|
||||
if (newVal.Value ~= game.Lighting.Security.ClientScriptMD5.Value or newVal.Value == "") then
|
||||
invalidSecurityVals = invalidSecurityVals + 1
|
||||
|
||||
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 (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
|
||||
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
|
||||
|
||||
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
|
||||
print(Player.Name .. " is using an invalid modified client! Kicking...")
|
||||
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)
|
||||
if (IsShaderSupportingClient()) then
|
||||
if (game.Lighting:findFirstChild("SkipSecurity") ~= nil) then
|
||||
if (game.Lighting.SkipSecurity:findFirstChild("Temp") ~= nil) then
|
||||
game.Lighting.SkipSecurity:remove()
|
||||
end
|
||||
if (game.Lighting:findFirstChild("SkipSecurity") ~= nil) then
|
||||
if (game.Lighting.SkipSecurity:findFirstChild("Temp") ~= nil) then
|
||||
game.Lighting.SkipSecurity:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
--adds a StringValue that lists the client's version.
|
||||
|
||||
local this = {}
|
||||
|
||||
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
|
||||
|
||||
function this:PreInit(Script, Client)
|
||||
|
|
@ -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.
|
||||
- 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:
|
||||
- ClientNamePrinter - Prints the name of the currently running client in a Lighting object. Good for determining client version in games.
|
||||
- ServerClock - Prints the server ticks in a Lighting object. Good for creating in-game events.
|
||||
- Utils - Prints the name of the currently running client and script in a Lighting object.
|
||||
- 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.
|
||||
- 2008M no longer uses OpenGL Legacy as the default graphics mode.
|
||||
|
|
@ -48,6 +47,7 @@ Fixes:
|
|||
- Fixed 2010L server joining not working.
|
||||
- Fixed 2007E based clients not loading all customized parts properly.
|
||||
- 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
|
||||
Enhancements:
|
||||
|
|
|
|||
|
|
@ -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\README-AND-CREDITS.TXT" "%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\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
|
||||
Loading…
Reference in New Issue