diff --git a/Addon_Template.lua b/Addon_Template.lua new file mode 100644 index 0000000..499defc --- /dev/null +++ b/Addon_Template.lua @@ -0,0 +1,37 @@ +-- executes before the game starts (server, solo, studio) +-- arguments: Script Type - returns the script type name (Server, Solo, Studio) +function PreInit(Script) +end + +-- executes after the game starts (server, solo, studio) +-- arguments: none +function PostInit() +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 OnLoadCharacter(Player, Appearance) +end + +-- executes after a player joins (server) +-- arguments: Player - the Player joining +function OnPlayerAdded(Player) +end + +-- executes after a player leaves (server) +-- arguments: Player - the Player leaving +function OnPlayerRemoved(Player) +end + +-- executes before a player gets kicked (server) +-- arguments: Player - the Player getting kicked, Reason - the reason the player got kicked +function OnPlayerKicked(Player, Reason) +end + +_G.CSScript_PreInit=PreInit +_G.CSScript_PostInit=PostInit +_G.CSScript_OnLoadCharacter=OnLoadCharacter +_G.CSScript_OnPlayerAdded=OnPlayerAdded +_G.CSScript_OnPlayerRemoved=OnPlayerRemoved +_G.CSScript_OnPlayerKicked=OnPlayerKicked \ No newline at end of file diff --git a/scripts/batch/github_sync.bat b/scripts/batch/github_sync.bat index 08b1108..25b069d 100644 --- a/scripts/batch/github_sync.bat +++ b/scripts/batch/github_sync.bat @@ -141,4 +141,5 @@ XCOPY "%cd%\Novetus\LICENSE.txt" "%dest%\LICENSE" /y XCOPY "%cd%\Novetus\LICENSE-QUERY-PHP.txt" "%dest%\LICENSE-QUERY-PHP" /y XCOPY "%cd%\Novetus\LICENSE-RESHADE.txt" "%dest%\LICENSE-RESHADE" /y XCOPY "%cd%\Novetus\README-AND-CREDITS.TXT" "%dest%" /y +XCOPY "%cd%\Novetus\Addon_Template.lua" "%dest%" /y if %debug%==1 pause \ No newline at end of file diff --git a/scripts/game/2006S-Shaders/CSMPFunctions.lua b/scripts/game/2006S-Shaders/CSMPFunctions.lua index 70aa012..13ee89c 100644 --- a/scripts/game/2006S-Shaders/CSMPFunctions.lua +++ b/scripts/game/2006S-Shaders/CSMPFunctions.lua @@ -19,6 +19,8 @@ function KickPlayer(Player,reason) Server = game:service("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -289,6 +291,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti end end + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) + coroutine.resume(coroutine.create(function() while Player ~= nil do wait(0.1) @@ -313,6 +317,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) InitalizeSecurityValues(game.Lighting,ClientEXEMD5,LauncherMD5,ClientScriptMD5) Server.IncommingConnection:connect(IncommingConnection) diff --git a/scripts/game/2006S/CSMPFunctions.lua b/scripts/game/2006S/CSMPFunctions.lua index 81faf25..c5c416f 100644 --- a/scripts/game/2006S/CSMPFunctions.lua +++ b/scripts/game/2006S/CSMPFunctions.lua @@ -19,6 +19,8 @@ function KickPlayer(Player,reason) Server = game:service("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -289,6 +291,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti end end + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) + coroutine.resume(coroutine.create(function() while Player ~= nil do wait(0.1) @@ -313,6 +317,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) InitalizeSecurityValues(game.Lighting,ClientEXEMD5,LauncherMD5,ClientScriptMD5) Server.IncommingConnection:connect(IncommingConnection) diff --git a/scripts/game/2007E-Shaders/CSMPFunctions.lua b/scripts/game/2007E-Shaders/CSMPFunctions.lua index 60e1622..27a0f55 100644 --- a/scripts/game/2007E-Shaders/CSMPFunctions.lua +++ b/scripts/game/2007E-Shaders/CSMPFunctions.lua @@ -19,6 +19,8 @@ function KickPlayer(Player,reason) Server = game:service("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -351,6 +353,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti end end + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) + coroutine.resume(coroutine.create(function() while Player ~= nil do wait(0.1) @@ -375,6 +379,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) InitalizeSecurityValues(game.Lighting,ClientEXEMD5,LauncherMD5,ClientScriptMD5) Server.IncommingConnection:connect(IncommingConnection) diff --git a/scripts/game/2007E/CSMPFunctions.lua b/scripts/game/2007E/CSMPFunctions.lua index 60e1622..27a0f55 100644 --- a/scripts/game/2007E/CSMPFunctions.lua +++ b/scripts/game/2007E/CSMPFunctions.lua @@ -19,6 +19,8 @@ function KickPlayer(Player,reason) Server = game:service("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -351,6 +353,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti end end + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) + coroutine.resume(coroutine.create(function() while Player ~= nil do wait(0.1) @@ -375,6 +379,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) InitalizeSecurityValues(game.Lighting,ClientEXEMD5,LauncherMD5,ClientScriptMD5) Server.IncommingConnection:connect(IncommingConnection) diff --git a/scripts/game/2007M-Shaders/CSMPFunctions.lua b/scripts/game/2007M-Shaders/CSMPFunctions.lua index aa07240..3fb0084 100644 --- a/scripts/game/2007M-Shaders/CSMPFunctions.lua +++ b/scripts/game/2007M-Shaders/CSMPFunctions.lua @@ -19,6 +19,8 @@ function KickPlayer(Player,reason) Server = game:GetService("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -411,6 +413,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti end end + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) + coroutine.resume(coroutine.create(function() while Player ~= nil do wait(0.1) @@ -435,6 +439,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) InitalizeSecurityValues(game.Lighting,ClientEXEMD5,LauncherMD5,ClientScriptMD5) Server.IncommingConnection:connect(IncommingConnection) diff --git a/scripts/game/2007M/CSMPFunctions.lua b/scripts/game/2007M/CSMPFunctions.lua index 3d974b3..ba1e489 100644 --- a/scripts/game/2007M/CSMPFunctions.lua +++ b/scripts/game/2007M/CSMPFunctions.lua @@ -19,6 +19,8 @@ function KickPlayer(Player,reason) Server = game:GetService("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -411,6 +413,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti end end + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) + coroutine.resume(coroutine.create(function() while Player ~= nil do wait(0.1) @@ -435,6 +439,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) InitalizeSecurityValues(game.Lighting,ClientEXEMD5,LauncherMD5,ClientScriptMD5) Server.IncommingConnection:connect(IncommingConnection) diff --git a/scripts/game/2008M/CSMPFunctions.lua b/scripts/game/2008M/CSMPFunctions.lua index 346238b..18aadc3 100644 --- a/scripts/game/2008M/CSMPFunctions.lua +++ b/scripts/game/2008M/CSMPFunctions.lua @@ -19,6 +19,8 @@ function KickPlayer(Player,reason) Server = game:GetService("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -529,6 +531,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti end end + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) + while true do wait(0.001) if (game.Lighting:findFirstChild("DisableRespawns") == nil) then @@ -551,6 +555,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) InitalizeSecurityValues(game.Lighting,ClientEXEMD5,LauncherMD5,ClientScriptMD5) Server.IncommingConnection:connect(IncommingConnection) diff --git a/scripts/game/2009E-HD/CSMPFunctions.lua b/scripts/game/2009E-HD/CSMPFunctions.lua index 0bdf5ca..5114ac2 100644 --- a/scripts/game/2009E-HD/CSMPFunctions.lua +++ b/scripts/game/2009E-HD/CSMPFunctions.lua @@ -19,6 +19,8 @@ function KickPlayer(Player,reason) Server = game:GetService("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -610,6 +612,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti end end + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) + while true do wait(0.001) if (game.Lighting:findFirstChild("DisableRespawns") == nil) then @@ -632,6 +636,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) InitalizeSecurityValues(game.Lighting,ClientEXEMD5,LauncherMD5,ClientScriptMD5) Server.IncommingConnection:connect(IncommingConnection) diff --git a/scripts/game/2009E/CSMPFunctions.lua b/scripts/game/2009E/CSMPFunctions.lua index 0bdf5ca..5114ac2 100644 --- a/scripts/game/2009E/CSMPFunctions.lua +++ b/scripts/game/2009E/CSMPFunctions.lua @@ -19,6 +19,8 @@ function KickPlayer(Player,reason) Server = game:GetService("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -610,6 +612,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti end end + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) + while true do wait(0.001) if (game.Lighting:findFirstChild("DisableRespawns") == nil) then @@ -632,6 +636,8 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) InitalizeSecurityValues(game.Lighting,ClientEXEMD5,LauncherMD5,ClientScriptMD5) Server.IncommingConnection:connect(IncommingConnection) diff --git a/scripts/game/2010L/CSMPFunctions.lua b/scripts/game/2010L/CSMPFunctions.lua index 9539c2d..7acc624 100644 --- a/scripts/game/2010L/CSMPFunctions.lua +++ b/scripts/game/2010L/CSMPFunctions.lua @@ -20,6 +20,8 @@ function KickPlayer(Player,reason) Server = game:GetService("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -627,12 +629,16 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti Player.Chatted:connect(function(msg) print(Player.Name.."; "..msg) end) + + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) end) PlayerService.PlayerRemoving:connect(function(Player) print("Player '" .. Player.Name .. "' with ID '" .. Player.userId .. "' leaving") if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) RunService:Run() game.Workspace:InsertContent("rbxasset://Fonts//libraries.rbxm") diff --git a/scripts/game/2011E/CSMPFunctions.lua b/scripts/game/2011E/CSMPFunctions.lua index fa0f12e..21d53dc 100644 --- a/scripts/game/2011E/CSMPFunctions.lua +++ b/scripts/game/2011E/CSMPFunctions.lua @@ -24,6 +24,8 @@ function KickPlayer(Player,reason) Server = game:GetService("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -651,12 +653,16 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti Player.Chatted:connect(function(msg) print(Player.Name.."; "..msg) end) + + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) end) PlayerService.PlayerRemoving:connect(function(Player) print("Player '" .. Player.Name .. "' with ID '" .. Player.userId .. "' leaving") if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) RunService:Run() game.Workspace:InsertContent("rbxasset://Fonts//libraries.rbxm") diff --git a/scripts/game/2011M/CSMPFunctions.lua b/scripts/game/2011M/CSMPFunctions.lua index c3178fd..2a9df7a 100644 --- a/scripts/game/2011M/CSMPFunctions.lua +++ b/scripts/game/2011M/CSMPFunctions.lua @@ -22,6 +22,8 @@ function KickPlayer(Player,reason) Server = game:GetService("NetworkServer") if (Player ~= nil) then + pcall(function() _G.CSScript_OnPlayerKicked(Player,reason) end) + 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 @@ -657,12 +659,16 @@ function CSServer(Port,PlayerLimit,ClientEXEMD5,LauncherMD5,ClientScriptMD5,Noti Player.Chatted:connect(function(msg) print(Player.Name.."; "..msg) end) + + pcall(function() _G.CSScript_OnPlayerAdded(Player) end) end) PlayerService.PlayerRemoving:connect(function(Player) print("Player '" .. Player.Name .. "' with ID '" .. Player.userId .. "' leaving") if (showServerNotifications) then game.Players:Chat("Player '" .. Player.Name .. "' left") end + + pcall(function() _G.CSScript_OnPlayerRemoved(Player) end) end) RunService:Run() game.Workspace:InsertContent("rbxasset://Fonts//libraries.rbxm")