addon api changes/fixes

This commit is contained in:
Bitl 2022-07-11 17:35:21 -07:00
parent c495bd7ff5
commit 4743d8e606
7 changed files with 30 additions and 21 deletions

View File

@ -18,56 +18,54 @@ end
Modules = {} Modules = {}
for i,v in pairs(Scripts) do for i,v in pairs(Scripts) do
pcall(function() dofile(v) end) local success, response = pcall(function() dofile(v) end)
pcall(function() _G.CSScript_AddModule(Modules) end)
if (not success) then
print("AddonLoader: Failed to load script: " .. response)
else
_G.CSScript_AddModule(Modules)
end
end end
function PreInit(Script, Client) function PreInit(Script, Client)
for i,v in pairs(Modules) do for i,v in pairs(Modules) do
pcall(function() v:PreInit(Script, Client) end) pcall(function() v:PreInit(Script, Client) end)
pcall(function() print(v:Name() .. " called PreInit") end)
end end
end end
function PostInit() function PostInit()
for i,v in pairs(Modules) do for i,v in pairs(Modules) do
pcall(function() v:PostInit() end) pcall(function() v:PostInit() end)
pcall(function() print(v:Name() .. " called PostInit") 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
pcall(function() v:OnLoadCharacter(Player, Appearance) end) pcall(function() v:OnLoadCharacter(Player, Appearance) end)
pcall(function() print(v:Name() .. " called OnLoadCharacter") 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
pcall(function() v:OnPlayerAdded(Player) end) pcall(function() v:OnPlayerAdded(Player) end)
pcall(function() print(v:Name() .. " called OnPlayerAdded") 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
pcall(function() v:OnPlayerRemoved(Player) end) pcall(function() v:OnPlayerRemoved(Player) end)
pcall(function() print(v:Name() .. " called OnPlayerRemoved") 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
pcall(function() v:OnPlayerKicked(Player, Reason) end) pcall(function() v:OnPlayerKicked(Player, Reason) end)
pcall(function() print(v:Name() .. " called OnPlayerKicked") 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
pcall(function() v:OnPrePlayerKicked(Player, Reason) end) pcall(function() v:OnPrePlayerKicked(Player, Reason) end)
pcall(function() print(v:Name() .. " called OnPrePlayerKicked") end)
end end
end end

View File

@ -1,5 +1,9 @@
local this = {} local this = {}
function this:Name()
return "Template"
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)
@ -36,9 +40,10 @@ end
function this:OnPrePlayerKicked(Player, Reason) function this:OnPrePlayerKicked(Player, Reason)
end end
-- DO NOT MODIFY THIS. this is required to load this addon into the game. -- DO NOT REMOVE THIS. this is required to load this addon into the game.
function AddModule(t) function AddModule(t)
print("AddonLoader: Adding " .. v:Name())
table.insert(t, this) table.insert(t, this)
end end

View File

@ -13,6 +13,7 @@ function this:PreInit(Script, Client)
end end
function AddModule(t) function AddModule(t)
print("AddonLoader: Adding " .. this:Name())
table.insert(t, this) table.insert(t, this)
end end

View File

@ -23,14 +23,14 @@ end
-- executes before a player gets kicked (server) -- executes before a player gets kicked (server)
-- arguments: Player - the Player getting kicked, Reason - the reason the player got kicked -- 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 if (IsShaderSupportingClient()) then
validLauncher = false validLauncher = false
for _,newVal in pairs(Player.Security:GetChildren()) do for _,newVal in pairs(Player.Security:children()) do
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 or newVal.Value == "") then
validLauncher = true validLauncher = true
@ -42,7 +42,8 @@ function this:OnPrePlayerKicked(Player, Reason)
print(Player.Name .. " is using a valid modified client!") print(Player.Name .. " is using a valid modified client!")
local ver = Instance.new("StringValue",game.Lighting) local ver = Instance.new("StringValue",game.Lighting)
ver.Name = "SkipSecurity" ver.Name = "SkipSecurity"
ver.Value = "temp" local tempTag = Instance.new("StringValue",ver)
tempTag.Name = "Temp"
end end
end end
end end
@ -51,14 +52,17 @@ end
-- arguments: Player - Player getting a character loaded, Appearance - The object containing the appearance values -- 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. -- 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 (game.Lighting:FindFirstChild("SkipSecurity") ~= nil and game.Lighting.SkipSecurity.Value == "temp") then if (IsShaderSupportingClient()) then
game.Lighting.SkipSecurity:remove() if (game.Lighting:findFirstChild("SkipSecurity") ~= nil) then
if (game.Lighting.SkipSecurity:findFirstChild("Temp") ~= nil) then
game.Lighting.SkipSecurity:remove()
end
end
end end
end end
-- DO NOT MODIFY THIS. this is required to load this addon into the game.
function AddModule(t) function AddModule(t)
print("AddonLoader: Adding " .. this:Name())
table.insert(t, this) table.insert(t, this)
end end

View File

@ -1,9 +1,9 @@
1.3 Snapshot v22.8222.20490.1 1.3 Snapshot v22.8222.20490.3
Enhancements: Enhancements:
- Added support for multiple addon scripts! - Added support for multiple addon scripts!
- Thanks to BRAVONATCHO for the idea! - Thanks to BRAVONATCHO for the idea!
- Added OnPrePlayerKicked to the scripting API. - Added OnPrePlayerKicked to the scripting API.
- You can now join games with Shaders clients! - You can now join normal 2007 servers with Shaders clients (and vice versa)!
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
1.3 Snapshot v22.8222.20490.2 1.3 Snapshot v22.8222.20490.2
Enhancements: Enhancements:

View File

@ -8,6 +8,6 @@ ExtendedVersionNumber=True
ExtendedVersionEditChangelog=True ExtendedVersionEditChangelog=True
//ExtendedVersionTemplate=%version% v?.2022.%extended-revision%%lite% //ExtendedVersionTemplate=%version% v?.2022.%extended-revision%%lite%
ExtendedVersionTemplate=%version% Snapshot v22.%build%.%revision%.%extended-revision% ExtendedVersionTemplate=%version% Snapshot v22.%build%.%revision%.%extended-revision%
ExtendedVersionRevision=1 ExtendedVersionRevision=3
IsLite=False IsLite=False
InitialBootup=False InitialBootup=False

View File

@ -205,4 +205,5 @@ Látom.
[stylish]Tell me how it felt when you walked on water. Did you get your wish? [stylish]Tell me how it felt when you walked on water. Did you get your wish?
[normal]GET TO THE SHIPS! IT'S OUR ONLY CHANCE!|From the 1986 Transformers movie. [normal]GET TO THE SHIPS! IT'S OUR ONLY CHANCE!|From the 1986 Transformers movie.
Standing here, I realize... Standing here, I realize...
good grief! good grief!
This machine kills fascists