fix up addonloader

This commit is contained in:
Bitl 2022-07-07 17:18:04 -07:00
parent 946fa9df2d
commit 6ecad17c6f

View File

@ -18,56 +18,56 @@ end
Modules = {}
for i,v in pairs(Scripts) do
dofile(v)
_G.CSScript_AddModule(Modules)
pcall(function() dofile(v) end)
pcall(function() _G.CSScript_AddModule(Modules) end)
end
function PreInit(Script, Client)
for i,v in pairs(Modules) do
pcall(function() v:PreInit(Script, Client) end)
print(v:Name() .. " called PreInit")
pcall(function() print(v:Name() .. " called PreInit") end)
end
end
function PostInit()
for i,v in pairs(Modules) do
pcall(function() v:PostInit() end)
print(v:Name() .. " called PostInit")
pcall(function() print(v:Name() .. " called PostInit") end)
end
end
function OnLoadCharacter(Player, Appearance)
for i,v in pairs(Modules) do
pcall(function() v:OnLoadCharacter(Player, Appearance) end)
print(v:Name() .. " called OnLoadCharacter")
pcall(function() print(v:Name() .. " called OnLoadCharacter") end)
end
end
function OnPlayerAdded(Player)
for i,v in pairs(Modules) do
pcall(function() v:OnPlayerAdded(Player) end)
print(v:Name() .. " called OnPlayerAdded")
pcall(function() print(v:Name() .. " called OnPlayerAdded") end)
end
end
function OnPlayerRemoved(Player)
for i,v in pairs(Modules) do
pcall(function() v:OnPlayerRemoved(Player) end)
print(v:Name() .. " called OnPlayerRemoved")
pcall(function() print(v:Name() .. " called OnPlayerRemoved") end)
end
end
function OnPlayerKicked(Player, Reason)
for i,v in pairs(Modules) do
pcall(function() v:OnPlayerKicked(Player, Reason) end)
print(v:Name() .. " called OnPlayerKicked")
pcall(function() print(v:Name() .. " called OnPlayerKicked") end)
end
end
function OnPrePlayerKicked(Player, Reason)
for i,v in pairs(Modules) do
pcall(function() v:OnPrePlayerKicked(Player, Reason) end)
print(v:Name() .. " called OnPrePlayerKicked")
pcall(function() print(v:Name() .. " called OnPrePlayerKicked") end)
end
end