From 67002568d169cdac71736d8bef1f097c976e8013 Mon Sep 17 00:00:00 2001 From: Sky Date: Fri, 24 Sep 2021 12:54:46 -0400 Subject: [PATCH 01/17] Update Changelog.lua --- MainModule/Server/Shared/Changelog.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/MainModule/Server/Shared/Changelog.lua b/MainModule/Server/Shared/Changelog.lua index a5de9b5c71..90eda2fc05 100644 --- a/MainModule/Server/Shared/Changelog.lua +++ b/MainModule/Server/Shared/Changelog.lua @@ -1,6 +1,7 @@ return { "Version: 228"; "*Drag edges to expand*"; + "testing ignore"; ""; "[v228 9.8.2021 15:40 EST]"; "*Fixed :hat"; From 403f0c6aa57421dc382900c99de5e23773e7cc22 Mon Sep 17 00:00:00 2001 From: Sky Date: Fri, 24 Sep 2021 12:55:04 -0400 Subject: [PATCH 02/17] Update Changelog.lua --- MainModule/Server/Shared/Changelog.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/MainModule/Server/Shared/Changelog.lua b/MainModule/Server/Shared/Changelog.lua index 90eda2fc05..a5de9b5c71 100644 --- a/MainModule/Server/Shared/Changelog.lua +++ b/MainModule/Server/Shared/Changelog.lua @@ -1,7 +1,6 @@ return { "Version: 228"; "*Drag edges to expand*"; - "testing ignore"; ""; "[v228 9.8.2021 15:40 EST]"; "*Fixed :hat"; From 967bf81f063f1a83cb38a11861637d50b8cd471a Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Thu, 30 Sep 2021 21:40:58 +0100 Subject: [PATCH 03/17] Folder ban fix mw3 --- MainModule/Server/Commands/Admins.lua | 18 +++++---- MainModule/Server/Core/HTTP.lua | 54 ++++++++++++++------------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/MainModule/Server/Commands/Admins.lua b/MainModule/Server/Commands/Admins.lua index dac1aa60b3..20e5acda2a 100644 --- a/MainModule/Server/Commands/Admins.lua +++ b/MainModule/Server/Commands/Admins.lua @@ -1289,27 +1289,29 @@ return function(Vargs, env) local appkey = Settings.Trello_AppKey local token = Settings.Trello_Token - if not Settings.Trello_Enabled or board == "" or appkey == "" or token == "" then server.Functions.Hint('Trello has not been configured in settings', {plr}) return end + if not Settings.Trello_Enabled or board == "" or appkey == "" or token == "" then Functions.Hint('Trello has not been configured in settings', {plr}) return end local trello = HTTP.Trello.API(appkey,token) local lists = trello.getLists(board) local list = trello.getListObj(lists,{"Banlist","Ban List","Bans"}) local level = data.PlayerData.Level - for i,v in pairs(service.GetPlayers(plr,args[1], { + for _, v in pairs(service.GetPlayers(plr,args[1], { DontError = false; IsServer = false; IsKicking = true; UseFakePlayer = true; - }))do + })) do if level > Admin.GetLevel(v) then - trello.makeCard(list.id,tostring(v)..":".. tostring(v.UserId), - "Administrator: " .. tostring(plr) .. - "\nReason: ".. (args[2] or "N/A")) - HTTP.Trello.Update() - Functions.Hint("Trello banned ".. tostring(v),{plr}) + trello.makeCard(list.id, + string.format("%s:%d", (v and tostring(v.Name) or tostring(v)), tostring(v.UserId)), + string.format("Administrator: %s\nReason: %s", plr.Name, (args[2] or "N/A")) + ) + Functions.Hint("Trello banned ".. (v and tostring(v.Name) or tostring(v)), {plr}) end end + + HTTP.Trello.Update() end; }; diff --git a/MainModule/Server/Core/HTTP.lua b/MainModule/Server/Core/HTTP.lua index ee44898147..8be1d50e9b 100644 --- a/MainModule/Server/Core/HTTP.lua +++ b/MainModule/Server/Core/HTTP.lua @@ -72,34 +72,31 @@ return function(Vargs) PerformedCommands = {}; Update = function() + if not Settings.Trello_Enabled then + return; + end + if not HTTP.CheckHttp() then --HTPP.Trello.Bans = {'Http is not enabled! Cannot connect to Trello!'} warn('Http is not enabled! Cannot connect to Trello!') - elseif not Settings.Trello_Enabled then - -- Do something else? else - local boards = {} + local admins, mods, HeadAdmins, creators = {}, {}, {}, {} local bans = {} - local admins = {} - local mods = {} - local HeadAdmins = {} - local helpers = {} - local creators = {} - local music = {} - local insertlist = {} local mutes = {} - local perms = {} - local blacklist = {} + local music = {} local whitelist = {} + local blacklist = {} + local insertlist = {} + local boards = {} local function grabData(board) local trello = HTTP.Trello.API(Settings.Trello_AppKey,Settings.Trello_Token) local oldListObj = trello.getListObj; trello.getListObj = function(...) - local vargs = {...} + local vargs = table.pack(...) return select(2, service.Queue("TrelloCall", function() wait(10/60) - return oldListObj(table.unpack(vargs)) + return oldListObj(table.unpack(vargs, 1, vargs.n)) end, 30, true)) end @@ -138,8 +135,8 @@ return function(Vargs) if musicList then local cards = trello.getCards(musicList.id) for l,k in pairs(cards) do - if k.name:match('^(.*):(.*)') then - local a,b=k.name:match('^(.*):(.*)') + if string.match(k.name, '^(.*):(.*)') then + local a,b=string.match(k.name, '^(.*):(.*)') table.insert(music,{Name = a,ID = tonumber(b)}) end end @@ -147,9 +144,10 @@ return function(Vargs) if insertList then local cards = trello.getCards(insertList.id) - for l,k in pairs(cards) do - if k.name:match('^(.*):(.*)') then - local a,b=k.name:match('^(.*):(.*)') + + for _, k in pairs(cards) do + if string.match(k.name, '^(.*):(.*)') then + local a,b=string.match(k.name, '^(.*):(.*)') table.insert(insertlist,{Name = a,ID = tonumber(b)}) end end @@ -157,8 +155,8 @@ return function(Vargs) if permList then local cards = trello.getCards(permList.id) - for l,k in pairs(cards) do - local com,level = k.name:match("^(.*):(.*)") + for _, k in pairs(cards) do + local com,level = string.match(k.name, "^(.*):(.*)") if com and level then Admin.SetPermission(com,level) end @@ -167,22 +165,26 @@ return function(Vargs) if commandList then local cards = trello.getCards(commandList.id) - for l,k in pairs(cards) do + for _, k in pairs(cards) do if not HTTP.Trello.PerformedCommands[tostring(k.id)] then local cmd = k.name local placeid - if cmd:sub(1,1)=="$" then - placeid = cmd:sub(2):match(".%d+") - cmd = cmd:sub(#placeid+2) + + if string.sub(cmd, 1, 1) == "$" then + placeid = string.match(string.sub(cmd, 2), ".%d+") + cmd = string.sub(cmd, #placeid+2) placeid = tonumber(placeid) end - if placeid and game.PlaceId~=placeid then return end + if placeid and game.PlaceId ~= placeid then return end + Admin.RunCommand(cmd) HTTP.Trello.PerformedCommands[tostring(k.id)] = true + Logs.AddLog(Logs.Script,{ Text = "Trello command executed"; Desc = cmd; }) + if Settings.Trello_Token ~= "" then pcall(trello.makeComment,k.id,"Ran Command: "..cmd.."\nPlace ID: "..game.PlaceId.."\nServer Job Id: "..game.JobId.."\nServer Players: "..#service.GetPlayers().."\nServer Time: "..service.FormatTime()) end From 34d8d61a7c98a8aa39ff52109d483324939055c5 Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Fri, 1 Oct 2021 23:30:12 +0100 Subject: [PATCH 04/17] service revert of tostring change --- MainModule/Server/Commands/Moderators.lua | 89 +++++---- MainModule/Server/Core/Admin.lua | 48 +++-- MainModule/Server/Core/Commands.lua | 28 +-- MainModule/Server/Core/Functions.lua | 221 ++++++++++++---------- MainModule/Server/Shared/Service.lua | 8 +- 5 files changed, 220 insertions(+), 174 deletions(-) diff --git a/MainModule/Server/Commands/Moderators.lua b/MainModule/Server/Commands/Moderators.lua index 3d3dae57d9..3617f58ece 100644 --- a/MainModule/Server/Commands/Moderators.lua +++ b/MainModule/Server/Commands/Moderators.lua @@ -2598,42 +2598,57 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - for i,v in next,service.GetPlayers(plr,args[1]) do - coroutine.wrap(function() - local bb = service.New('BillboardGui') - local la = service.New('SelectionPartLasso',bb) - local Humanoid = plr.Character:FindFirstChild("Humanoid") - local Part = v.Character:FindFirstChild("HumanoidRootPart") - if Part and Humanoid then - la.Part = Part - la.Humanoid = Humanoid - bb.Name = v.Name..'Tracker' - bb.Adornee = v.Character.Head - bb.AlwaysOnTop = true - bb.StudsOffset = Vector3.new(0,2,0) - bb.Size = UDim2.new(0,100,0,40) - local f = service.New('Frame',bb) - f.BackgroundTransparency = 1 - f.Size = UDim2.new(1,0,1,0) - local name = service.New('TextLabel',f) - name.Text = v.DisplayName.."\n(@"..v.Name..")" - name.BackgroundTransparency = 1 - name.Font = "Arial" - name.TextColor3 = Color3.new(1,1,1) - name.TextStrokeColor3 = Color3.new(0,0,0) - name.TextStrokeTransparency = 0 - name.Size = UDim2.new(1,0,0,20) - name.TextScaled = true - name.TextWrapped = true - local arrow = name:clone() - arrow.Parent = f - arrow.Position = UDim2.new(0,0,0,20) - arrow.Text = 'v' - Remote.MakeLocal(plr,bb,false,true) - local event;event = v.CharacterRemoving:Connect(function() Remote.RemoveLocal(plr,v.Name..'Tracker') event:Disconnect() end) - local event2;event2 = plr.CharacterRemoving:Connect(function() Remote.RemoveLocal(plr,v.Name..'Tracker') event2:Disconnect() end) - end - end)() + local New = service.New + for i,v in pairs(service.GetPlayers(plr,args[1])) do + if v.Character and plr.Character then + task.defer(function() + local Humanoid = plr.Character:FindFirstChild("Humanoid") + local Part = v.Character:FindFirstChild("HumanoidRootPart") + local Head = v.Character:FindFirstChild("Head") + + if Part and Head and Humanoid then + local bb = New('BillboardGui', { + Name = v.Name .. "Tracker", + Adornee = Head, + AlwaysOnTop = true, + StudsOffset = Vector3.new(0, 2, 0), + Size = UDim2.new(0, 100, 0, 40) + }) + New('SelectionPartLasso', { + Part = Part, + Humanoid = Humanoid, + Parent = bb, + }) + local f = New('Frame', { + BackgroundTransparency = 1; + Size = UDim2.new(1,0,1,0); + Parent = bb; + }) + + local name = New('TextLabel', { + Text = v.DisplayName.."\n(@"..v.Name..")", + BackgroundTransparency = 1, + Font = Enum.Font.Arial, + TextColor3 = Color3.new(1,1,1), + TextStrokeColor3 = Color3.new(0, 0, 0), + TextStrokeTransparency = 0, + Size = UDim2.new(1,0,0,20), + TextScaled = true, + TextWrapped = true, + + Parent = f, + }) + local arrow = name:Clone() + arrow.Position = UDim2.new(0,0,0,20) + arrow.Text = 'v' + arrow.Parent = f + + Remote.MakeLocal(plr,bb,false) + local event;event = v.CharacterRemoving:Connect(function() Remote.RemoveLocal(plr,v.Name..'Tracker') event:Disconnect() end) + local event2;event2 = plr.CharacterRemoving:Connect(function() Remote.RemoveLocal(plr,v.Name..'Tracker') event2:Disconnect() end) + end + end) + end end end }; @@ -3056,7 +3071,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) for i,v in pairs(service.GetPlayers(plr,args[1])) do - Functions.ConvertPlayerCharacterToRig(v, "R6") + task.defer(Functions.ConvertPlayerCharacterToRig, v, "R6") end end }; diff --git a/MainModule/Server/Core/Admin.lua b/MainModule/Server/Core/Admin.lua index 9aa80ccf11..3475c65224 100644 --- a/MainModule/Server/Core/Admin.lua +++ b/MainModule/Server/Core/Admin.lua @@ -225,7 +225,7 @@ return function(Vargs) local groups = service.GroupService:GetGroupsAsync(p.UserId) or {} local isID = type(group) == "number" if groups then - for i,v in next,groups do + for i,v in ipairs(groups) do if (isID and group == v.Id) or (not isID and group == v.Name) then return v end @@ -258,8 +258,13 @@ return function(Vargs) DoCheck = function(p, check, banCheck) local pType = type(p) local cType = type(check) + + local lower = string.lower + local match = string.match + local sub = string.sub + if pType == "string" and cType == "string" then - if p == check or check:lower():sub(1,#tostring(p)) == p:lower() then + if p == check or sub(lower(check), 1, #tostring(p)) == lower(p) then return true end elseif pType == "number" and (cType == "number" or tonumber(check)) then @@ -272,9 +277,9 @@ return function(Vargs) end elseif cType == "string" and pType == "userdata" and p:IsA("Player") then local isGood = p and p.Parent == service.Players - if isGood and check:match("^Group:(.*):(.*)") then - local sGroup,sRank = check:match("^Group:(.*):(.*)") - local group,rank = tonumber(sGroup),tonumber(sRank) + if isGood and match(check, "^Group:(.*):(.*)") then + local sGroup,sRank = match(check, "^Group:(.*):(.*)") + local group, rank = tonumber(sGroup), tonumber(sRank) if group and rank then local pGroup = Admin.GetPlayerGroup(p, group) if pGroup then @@ -284,30 +289,30 @@ return function(Vargs) end end end - elseif isGood and check:sub(1, 6) == "Group:" then --check:match("^Group:(.*)") then - local group = tonumber(check:match("^Group:(.*)")) + elseif isGood and sub(check, 1, 6) == "Group:" then --check:match("^Group:(.*)") then + local group = tonumber(match(check, "^Group:(.*)")) if group then local pGroup = Admin.GetPlayerGroup(p, group) if pGroup then return true end end - elseif isGood and check:sub(1, 5) == "Item:" then --check:match("^Item:(.*)") then - local item = tonumber(check:match("^Item:(.*)")) + elseif isGood and sub(check, 1, 5) == "Item:" then --check:match("^Item:(.*)") then + local item = tonumber(match(check, "^Item:(.*)")) if item then if service.MarketPlace:PlayerOwnsAsset(p, item) then return true end end - elseif p and check:sub(1, 9) == "GamePass:" then --check:match("^GamePass:(.*)") then - local item = tonumber(check:match("^GamePass:(.*)")) + elseif p and sub(check, 1, 9) == "GamePass:" then --check:match("^GamePass:(.*)") then + local item = tonumber(match(check, "^GamePass:(.*)")) if item then if service.MarketPlace:UserOwnsGamePassAsync(p.UserId, item) then return true end end - elseif check:match("^(.*):(.*)") then - local player, sUserid = check:match("^(.*):(.*)") + elseif match(check, "^(.*):(.*)") then + local player, sUserid = match(check, "^(.*):(.*)") local userid = tonumber(sUserid) if player and userid and p.Name == player or p.userId == userid then return true @@ -605,7 +610,7 @@ return function(Vargs) local index,value for ind,ent in ipairs(list) do - if (type(ent)=="number" or type(ent)=="string") and (ent==p.userId or ent:lower()==p.Name:lower() or ent:lower()==(p.Name..":"..p.userId):lower()) then + if (type(ent)=="number" or type(ent)=="string") and (ent==p.userId or string.lower(ent)==string.lower(p.Name) or string.lower(ent)==string.lower(p.Name..":"..p.userId)) then index = ind value = ent end @@ -732,7 +737,7 @@ return function(Vargs) end if type(check) == "table" then - if type(name) == "string" and check.Name and check.Name:lower() == name:lower() then + if type(name) == "string" and check.Name and string.lower(check.Name) == string.lower(name) then return true; elseif id and check.UserId and check.UserId == id then return true; @@ -754,7 +759,7 @@ return function(Vargs) RemoveBan = function(name, doSave) local ret - for i,v in next,Settings.Banned do + for i,v in pairs(Settings.Banned) do if Admin.DoBanCheck(name, v) then table.remove(Settings.Banned, i) ret = v @@ -803,6 +808,7 @@ return function(Vargs) Message = error; Color = Color3.new(1,0,0) }) + return; end end end; @@ -818,7 +824,7 @@ return function(Vargs) isDonor = false; }}) if error then - error = error:match(":(.+)$") or "Unknown error" + error = string.match(error, ":(.+)$") or "Unknown error" Remote.MakeGui(plr,'Output',{Title = ''; Message = error; Color = Color3.new(1,0,0)}) end end @@ -944,16 +950,16 @@ return function(Vargs) end; GetArgs = function(msg,num,...) - local args = Functions.Split((msg:match("^.-"..Settings.SplitKey..'(.+)') or ''),Settings.SplitKey,num) or {} - for i,v in next,{...} do table.insert(args,v) end + local args = Functions.Split((string.match(msg, "^.-"..Settings.SplitKey..'(.+)') or ''),Settings.SplitKey,num) or {} + for i,v in pairs({...}) do table.insert(args,v) end return args end; AliasFormat = function(aliases, msg) if aliases then - for alias,cmd in next,aliases do + for alias,cmd in pairs(aliases) do if not Admin.CheckAliasBlacklist(alias) then - if msg:match("^"..alias) or msg:match("%s".. alias) then + if string.match(msg, "^"..alias) or string.match(msg, "%s".. alias) then msg = FormatAliasArgs(alias, cmd, msg); end end diff --git a/MainModule/Server/Core/Commands.lua b/MainModule/Server/Core/Commands.lua index e25f8e6b96..e8a52d6db0 100644 --- a/MainModule/Server/Core/Commands.lua +++ b/MainModule/Server/Core/Commands.lua @@ -30,7 +30,7 @@ return function(Vargs) --// Automatic New Command Caching and Ability to do server.Commands[":ff"] setmetatable(Commands, { __index = function(self, ind) - local targInd = Admin.CommandCache[ind:lower()] + local targInd = Admin.CommandCache[string.lower(ind)] if targInd then return rawget(Commands, targInd) end @@ -39,9 +39,9 @@ return function(Vargs) __newindex = function(self, ind, val) rawset(Commands, ind, val) if val and type(val) == "table" and val.Commands and val.Prefix then - for i,cmd in next,val.Commands do + for i,cmd in pairs(val.Commands) do Admin.PrefixCache[val.Prefix] = true; - Admin.CommandCache[(val.Prefix..cmd):lower()] = ind; + Admin.CommandCache[string.lower((val.Prefix..cmd))] = ind; end end end; @@ -51,12 +51,12 @@ return function(Vargs) --// Load command modules if server.CommandModules then - for i,module in next,server.CommandModules:GetChildren() do + for i,module in ipairs(server.CommandModules:GetChildren()) do local func = require(module) local ran,tab = pcall(func, Vargs, getfenv()) if ran and tab and type(tab) == "table" then - for ind,cmd in next,tab do + for ind,cmd in pairs(tab) do Commands[ind] = cmd; end @@ -76,22 +76,22 @@ return function(Vargs) Logs:AddLog("Script", "Commands Module Initialized") end; - function RunAfterPlugins() + local function RunAfterPlugins() --// Load custom user-supplied commands (settings.Commands) - for ind,cmd in next,Settings.Commands do - if cmd.Function then + for ind,cmd in pairs(Settings.Commands) do + if type(cmd) == "table" and cmd.Function then setfenv(cmd.Function, getfenv()); Commands[ind] = cmd; end end --// Change command permissions based on settings - for ind, cmd in next, Settings.Permissions or {} do - local com,level = cmd:match("^(.*):(.*)") + for ind, cmd in pairs(Settings.Permissions or {}) do + local com,level = string.match(cmd, "^(.*):(.*)") if com and level then - if level:find(",") then + if string.find(level, ",") then local newLevels = {} - for lvl in level:gmatch("[^%,]+") do + for lvl in string.gmatch(level, "[^%,]+") do table.insert(newLevels, service.Trim(lvl)) end @@ -103,14 +103,14 @@ return function(Vargs) end --// Update existing permissions to new levels - for i,cmd in next,Commands do + for i,cmd in pairs(Commands) do if type(cmd) == "table" and cmd.AdminLevel then local lvl = cmd.AdminLevel; if type(lvl) == "string" then cmd.AdminLevel = Admin.StringToComLevel(lvl); --print("Changed " .. tostring(lvl) .. " to " .. tostring(cmd.AdminLevel)) elseif type(lvl) == "table" then - for b,v in next,lvl do + for b,v in pairs(lvl) do lvl[b] = Admin.StringToComLevel(v); end end diff --git a/MainModule/Server/Core/Functions.lua b/MainModule/Server/Core/Functions.lua index 1e56ab5755..ee08be4db2 100644 --- a/MainModule/Server/Core/Functions.lua +++ b/MainModule/Server/Core/Functions.lua @@ -34,6 +34,7 @@ return function(Vargs) Logs:AddLog("Script", "Functions Module RunAfterPlugins Finished"); end + local insert = table.insert server.Functions = { Init = Init; RunAfterPlugins = RunAfterPlugins; @@ -43,7 +44,7 @@ return function(Vargs) Prefix = true; Absolute = true; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - table.insert(players,plr) + insert(players,plr) plus() end; }; @@ -55,21 +56,24 @@ return function(Vargs) Function = function(msg, plr, parent, players, getplr, plus, isKicking) local everyone = true if isKicking then - for i,v in next,parent:GetChildren() do + local lower = string.lower + local sub = string.sub + + for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) - if p.Name:lower():sub(1,#msg)==msg:lower() then + if sub(lower(p.Name), 1, #msg)==lower(msg) then everyone = false - table.insert(players,p) + insert(players,p) plus() end end end if everyone then - for i,v in next,parent:GetChildren() do + for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p then - table.insert(players,p) + insert(players,p) plus() end end @@ -91,10 +95,10 @@ return function(Vargs) Prefix = true; Absolute = true; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - for i,v in next,parent:GetChildren() do + for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p ~= plr then - table.insert(players,p) + insert(players,p) plus() end end @@ -117,7 +121,7 @@ return function(Vargs) end end - table.insert(players,p) + insert(players,p) plus(); end; }; @@ -127,10 +131,10 @@ return function(Vargs) Prefix = true; Absolute = true; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - for i,v in next,parent:GetChildren() do + for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if Admin.CheckAdmin(p,false) then - table.insert(players, p) + insert(players, p) plus() end end @@ -142,10 +146,10 @@ return function(Vargs) Prefix = true; Absolute = true; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - for i,v in next,parent:GetChildren() do + for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if not Admin.CheckAdmin(p,false) then - table.insert(players,p) + insert(players,p) plus() end end @@ -157,10 +161,10 @@ return function(Vargs) Prefix = true; Absolute = true; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - for i,v in next,parent:GetChildren() do + for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p:IsFriendsWith(plr.userId) then - table.insert(players,p) + insert(players,p) plus() end end @@ -171,14 +175,14 @@ return function(Vargs) Match = "@"; Prefix = false; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - local matched = msg:match("@(.*)") + local matched = string.match(msg, "@(.*)") local foundNum = 0 if matched then - for i,v in next,parent:GetChildren() do + for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p and p.Name == matched then - table.insert(players,p) + insert(players,p) plus() foundNum = foundNum+1 end @@ -190,14 +194,18 @@ return function(Vargs) ["%team"] = { Match = "%"; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - local matched = msg:match("%%(.*)") + local matched = string.match(msg, "%%(.*)") + + local lower = string.lower + local sub = string.sub + if matched then - for i,v in next,service.Teams:GetChildren() do - if v.Name:lower():sub(1,#matched) == matched:lower() then - for k,m in next,parent:GetChildren() do + for i,v in ipairs(service.Teams:GetChildren()) do + if sub(lower(v.Name), 1, #matched) == lower(matched) then + for k, m in ipairs(parent:GetChildren()) do local p = getplr(m) if p.TeamColor == v.TeamColor then - table.insert(players,p) + insert(players,p) plus() end end @@ -210,12 +218,12 @@ return function(Vargs) ["$group"] = { Match = "$"; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - local matched = msg:match("%$(.*)") + local matched = string.match(msg, "%$(.*)") if matched and tonumber(matched) then - for _,v in next,parent:GetChildren() do + for _,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p:IsInGroup(tonumber(matched)) then - table.insert(players,p) + insert(players,p) plus() end end @@ -226,15 +234,15 @@ return function(Vargs) ["id-"] = { Match = "id-"; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - local matched = tonumber(msg:match("id%-(.*)")) + local matched = tonumber(string.match(msg, "id%-(.*)")) local foundNum = 0 if matched then for _,v in next,parent:GetChildren() do local p = getplr(v) if p and p.userId == matched then - table.insert(players,p) + insert(players,p) plus() - foundNum = foundNum+1 + foundNum += 1 end end @@ -249,7 +257,7 @@ return function(Vargs) userId = tonumber(matched); }) - table.insert(players, fakePlayer) + insert(players, fakePlayer) plus() end end @@ -260,14 +268,14 @@ return function(Vargs) ["displayname-"] = { Match = "displayname-"; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - local matched = tonumber(msg:match("displayname%-(.*)")) + local matched = tonumber(string.match(msg, "displayname%-(.*)")) local foundNum = 0 if matched then for _,v in next,parent:GetChildren() do local p = getplr(v) if p and p.DisplayName == matched then - table.insert(players,p) + insert(players,p) plus() foundNum = foundNum+1 end @@ -279,15 +287,17 @@ return function(Vargs) ["team-"] = { Match = "team-"; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - print(1) - local matched = msg:match("team%-(.*)") + local lower = string.lower + local sub = string.sub + + local matched = string.match(msg, "team%-(.*)") if matched then - for i,v in next,service.Teams:GetChildren() do - if v.Name:lower():sub(1,#matched) == matched:lower() then - for k,m in next,parent:GetChildren() do + for i,v in ipairs(service.Teams:GetChildren()) do + if sub(lower(v.Name), 1, #matched) == lower(matched) then + for k,m in ipairs(parent:GetChildren()) do local p = getplr(m) if p.TeamColor == v.TeamColor then - table.insert(players, p) + insert(players, p) plus() end end @@ -300,12 +310,14 @@ return function(Vargs) ["group-"] = { Match = "group-"; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - local matched = msg:match("group%-(.*)") - if matched and tonumber(matched) then - for _,v in next,parent:GetChildren() do + local matched = string.match(msg, "group%-(.*)") + matched = tonumber(matched) + + if matched then + for _,v in ipairs(parent:GetChildren()) do local p = getplr(v) - if p:IsInGroup(tonumber(matched)) then - table.insert(players,p) + if p:IsInGroup(matched) then + insert(players,p) plus() end end @@ -316,14 +328,14 @@ return function(Vargs) ["-name"] = { Match = "-"; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - local matched = msg:match("%-(.*)") + local matched = string.match(msg, "%-(.*)") if matched then local removes = service.GetPlayers(plr,matched, { DontError = true; }) - for i,v in next,players do - for k,p in next,removes do + for i,v in pairs(players) do + for k,p in pairs(removes) do if v.Name == p.Name then table.remove(players,i) plus() @@ -342,6 +354,7 @@ return function(Vargs) local num = tonumber(matched) if not num then Remote.MakeGui(plr,'Output',{Title = 'Output'; Message = "Invalid number!"}) + return; end for i = 1,num do @@ -359,12 +372,13 @@ return function(Vargs) local num = tonumber(matched) if not num then Remote.MakeGui(plr,'Output',{Title = 'Output'; Message = "Invalid number!"}) + return; end for i,v in next,parent:GetChildren() do local p = getplr(v) if p ~= plr and plr:DistanceFromCharacter(p.Character.Head.Position) <= num then - table.insert(players,p) + insert(players,p) plus() end end @@ -443,31 +457,39 @@ return function(Vargs) local dontError = data and data.DontError; local isServer = data and data.IsServer; local isKicking = data and data.IsKicking; - local noID = data and data.NoID; + --local noID = data and data.NoID; local useFakePlayer = (data and data.UseFakePlayer ~= nil and data.UseFakePlayer) or true; local players = {} - local prefix = (data and data.Prefix) or Settings.SpecialPrefix - if isServer then prefix = "" end + --local prefix = (data and data.Prefix) or Settings.SpecialPrefix + --if isServer then prefix = "" end local parent = (data and data.Parent) or service.Players + local lower = string.lower + local sub = string.sub + local gmatch = string.gmatch + local function getplr(p) - if p and p:IsA("Player") then - return p - elseif p and p:IsA('NetworkReplicator') then - if p:GetPlayer()~=nil and p:GetPlayer():IsA('Player') then - return p:GetPlayer() + if p then + if p.ClassName == "Player" then + return p + elseif p:IsA("NetworkReplicator") then + local networkPeerPlayer = p:GetPlayer() + if networkPeerPlayer and networkPeerPlayer.ClassName == "Player" then + return networkPeerPlayer + end end end end local function checkMatch(msg) local doReturn; + local PlrLevel = Admin.GetLevel(plr) - for ind, data in next, Functions.PlayerFinders do - if not data.Level or (data.Level and Admin.GetLevel(plr) >= data.Level) then + for ind, data in pairs(Functions.PlayerFinders) do + if not data.Level or (data.Level and PlrLevel >= data.Level) then local check = ((data.Prefix and Settings.SpecialPrefix) or "")..data.Match - if (data.Absolute and msg:lower() == check) or (not data.Absolute and msg:lower():sub(1,#check) == check:lower()) then + if (data.Absolute and lower(msg) == check) or (not data.Absolute and sub(lower(msg), 1, #check) == lower(check)) then if data.Absolute then return data else --// Prioritize absolute matches over non-absolute matches @@ -481,23 +503,21 @@ return function(Vargs) end if plr == nil then - for i,v in pairs(parent:GetChildren()) do + for _, v in ipairs(parent:GetChildren()) do local p = getplr(v) if p then - table.insert(players,p) + insert(players,p) end end elseif plr and not names then return {plr} else - if names:lower():sub(1,2) == "##" then - error("String passed to GetPlayers is filtered: "..tostring(names)) + if sub(lower(names), 1, 2) == "##" then + error("String passed to GetPlayers is filtered: ".. tostring(names)) else - for s in names:gmatch('([^,]+)') do + for s in gmatch(names, '([^,]+)') do local plrs = 0 - local function plus() - plrs = plrs+1 - end + local function plus() plrs += 1 end local matchFunc = checkMatch(s) if matchFunc then @@ -505,8 +525,8 @@ return function(Vargs) else for i,v in next,parent:GetChildren() do local p = getplr(v) - if p and p:IsA("Player") and p.DisplayName:lower():sub(1,#s) == s:lower() then - table.insert(players,p) + if p and p.ClassName == "Player" and sub(lower(p.DisplayName), 1, #s) == lower(s) then + insert(players,p) plus() end end @@ -514,8 +534,8 @@ return function(Vargs) if plrs == 0 then for i,v in next,parent:GetChildren() do local p = getplr(v) - if p and p:IsA("Player") and p.Name:lower():sub(1,#s) == s:lower() then - table.insert(players,p) + if p and p.ClassName == "Player" and sub(lower(p.Name), 1, #s) == lower(s) then + insert(players,p) plus() end end @@ -533,7 +553,7 @@ return function(Vargs) userId = tonumber(userid); }) - table.insert(players, fakePlayer) + insert(players, fakePlayer) plus() end end @@ -584,22 +604,22 @@ return function(Vargs) ver_codename = "aencrypt_xorB64"; ver_full = "v1_AdonisEncrypt"; } - - --return "adonis:enc;;"..ver..";;"..Base64Encode(string.char(unpack(t))) + + --return "adonis:enc;;"..ver..";;"..Base64Encode(string.char(unpack(t))) return { encrypt = function(data) -- Add as many layers of encryption that are useful, even a basic cipher that throws exploiters off the actual encrypted data is accepted. -- What could count: XOR, Base64, Simple Encryption, A Cipher to cover the encryption, etc. -- What would be too complex: AES-256 CTR-Mode, Base91, PGP/Pretty Good Privacy - -- TO:DO; - Script XOR + Custom Encryption Backend, multiple security measures, if multiple encryption layers are used, - -- manipulate the key as much as possible; + -- TO:DO; - Script XOR + Custom Encryption Backend, multiple security measures, if multiple encryption layers are used, + -- manipulate the key as much as possible; -- -- - Create Custom Lightweight Encoding + Cipher format, custom B64 Alphabet, etc. -- 'ADONIS+HUJKLMSBP13579VWXYZadonis/hujklmsbp24680vwxyz><_*+-?!&@%#' -- -- - A basic form of string compression before encrypting should be used - -- If this becomes really nice, find a way to convert old datastore saved data to this new format. + -- If this becomes really nice, find a way to convert old datastore saved data to this new format. -- -- ? This new format has an URI-Like structure to provide correct versioning and easy migrating between formats @@ -612,7 +632,7 @@ return function(Vargs) end; decrypt = function(data) - + end; } end; @@ -620,17 +640,17 @@ return function(Vargs) -- ROT 47: ROT13 BUT BETTER Rot47Cipher = function(data,mode) if not (mode == "enc" or mode == "dec") then error("Invalid ROT47 Cipher Mode") end - + local base = 33 local range = 126 - 33 + 1 - + -- Checks if the given char is convertible -- ASCII Code should be within the range [33 .. 126] - local function rot47_convertible(char) + local function rot47_convertible(char) local v = char:byte() - return v >= 33 and v <= 126 + return v >= 33 and v <= 126 end - + local function cipher(str, key) return (str:gsub('.', function(s) if not rot47_convertible(s) then return s end @@ -1184,19 +1204,30 @@ return function(Vargs) end; ConvertPlayerCharacterToRig = function(plr, rigType) - local rigType2 = rigType or Enum.HumanoidRigType.R15 - local humd = plr.Character:WaitForChild("Humanoid"):GetAppliedDescription() or service.Players:GetHumanoidDescriptionFromUserId(userId) -- why is waitforchildofclass not a thing anymore :( - local model = game:GetService('Players'):CreateHumanoidModelFromDescription(humd,rigType2) --This code is basically PlrGear (:dollify) without the resizing and tool parts because it didnt work previously for some reason. Probably because of some internal roblox spaghetti. - model.Name=plr.DisplayName - local oldcframe = plr.Character:FindFirstChild("HumanoidRootPart").CFrame - local oldparent = plr.Character.Parent - plr.Character:Destroy() - plr.Character=model - model:SetPrimaryPartCFrame(oldcframe) - local cfr = (plr.Character:FindFirstChild('HumanoidRootPart')).CFrame - model.Parent = oldparent - model:SetPrimaryPartCFrame(cfr) - return model + rigType = rigType or Enum.HumanoidRigType.R15 + + local Humanoid = plr.Character and plr.Character:FindFirstChildOfClass("Humanoid") + + local HumanoidDescription = Humanoid:GetAppliedDescription() or service.Players:GetHumanoidDescriptionFromUserId(userId) + local newCharacterModel = service.Players:CreateHumanoidModelFromDescription(HumanoidDescription, rigType) + + newCharacterModel.Humanoid.DisplayName = Humanoid.DisplayName + newCharacterModel.Name = plr.Name + + local oldcframe = plr.Character and plr.Character.PrimaryPart and plr.Character.PrimaryPart.CFrame + + if plr.Character then + plr.Character:Destroy() + plr.Character = nil + end + plr.Character = newCharacterModel + + if oldcframe then + newCharacterModel:SetPrimaryPartCFrame(oldcframe) + end + newCharacterModel.Parent = workspace + + return newCharacterModel end; CreateClothingFromImageId = function(clothingtype, Id) diff --git a/MainModule/Server/Shared/Service.lua b/MainModule/Server/Shared/Service.lua index 46f2c7d2c0..7c3a7312f1 100644 --- a/MainModule/Server/Shared/Service.lua +++ b/MainModule/Server/Shared/Service.lua @@ -612,20 +612,14 @@ return function(errorHandler, eventChecker, fenceSpecific) object[ind] = UnWrap(val) end - local ToString = custom.ToString newMeta.__eq = service.RawEqual - newMeta.__tostring = ToString and function() - return ToString - end or function() - return tostring(object) - end + newMeta.__tostring = function() return custom.ToString or tostring(object) end -- Roblox doesn't respect this afaik. --newMeta.__gc = function(tab) -- custom:RemoveFromCache() --end newMeta.__metatable = "Adonis_Proxy" - custom:AddToCache() return newObj else From ffb08a2e55e49bee901696cdc9430af94e2f4094 Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Sat, 2 Oct 2021 16:24:04 +0100 Subject: [PATCH 05/17] revert cache of insert and addition of bytecode cache --- MainModule/Server/Commands/Fun.lua | 37 +++++++------ MainModule/Server/Commands/Moderators.lua | 10 ++-- MainModule/Server/Core/Anti.lua | 16 +++--- MainModule/Server/Core/Core.lua | 23 +++++--- MainModule/Server/Core/Functions.lua | 67 +++++++++++------------ MainModule/Server/Core/Variables.lua | 59 ++++++++++---------- 6 files changed, 111 insertions(+), 101 deletions(-) diff --git a/MainModule/Server/Commands/Fun.lua b/MainModule/Server/Commands/Fun.lua index 0af9fa5247..39808a8842 100644 --- a/MainModule/Server/Commands/Fun.lua +++ b/MainModule/Server/Commands/Fun.lua @@ -422,7 +422,7 @@ return function(Vargs, env) audio.Volume = 0.5 audio:Play() wait(2) - for i,part in next,Variables.FrozenObjects do + for i,part in pairs(Variables.FrozenObjects) do part.Anchored = false end @@ -491,7 +491,7 @@ return function(Vargs, env) if not speed or not tonumber(speed) then speed = 1000 end - for i,v in next,service.GetPlayers(plr,args[1]) do + for i,v in pairs(service.GetPlayers(plr,args[1])) do Remote.Send(v,"Function","Dizzy",tonumber(speed)) end end @@ -983,7 +983,7 @@ return function(Vargs, env) end end - for i,p in next,players do + for i,p in pairs(players) do service.TrackTask("Thread: Thanos", function() for t = 0.1,1.1,0.05 do if p.Character then @@ -1110,7 +1110,7 @@ return function(Vargs, env) error(forYou[ind]) end - for i,p in next,service.GetPlayers(plr,args[1]) do + for i,p in ipairs(service.GetPlayers(plr,args[1])) do service.TrackTask("Thread: UFO", function() local char = p.Character local torso = p.Character:FindFirstChild("HumanoidRootPart") @@ -1184,7 +1184,7 @@ return function(Vargs, env) torso.Anchored = true tween:Play() - for i,v in next,p.Character:GetChildren() do + for i,v in ipairs(p.Character:GetChildren()) do if v:IsA("BasePart") then service.TweenService:Create(v, TweenInfo.new(1), { Transparency = 1 @@ -1216,7 +1216,7 @@ return function(Vargs, env) end ]]) - for i,v in next,p.Character:GetChildren() do + for i,v in ipairs(p.Character:GetChildren()) do if v:IsA("BasePart") then v.Anchored = true v.Transparency = 1 @@ -1402,7 +1402,7 @@ return function(Vargs, env) error(forYou[ind]) end - for i,p in next,service.GetPlayers(plr,args[1]) do + for i,p in ipairs(service.GetPlayers(plr,args[1])) do spawn(function() local char = p.Character local torso = p.Character:FindFirstChild("HumanoidRootPart") @@ -1674,7 +1674,7 @@ return function(Vargs, env) local nukes = {} local partsHit = {} - for i,v in next,Functions.GetPlayers(plr, args[1]) do + for i,v in ipairs(Functions.GetPlayers(plr, args[1])) do local char = v.Character local human = char and char:FindFirstChild("HumanoidRootPart") if human then @@ -1714,7 +1714,7 @@ return function(Vargs, env) end for i = 1, 333 do - for i,v in next,nukes do + for i,v in pairs(nukes) do local curPos = v.CFrame v.Size = v.Size + Vector3.new(3, 3, 3) v.CFrame = curPos @@ -1722,7 +1722,7 @@ return function(Vargs, env) wait(1/44) end - for i,v in next,nukes do + for i,v in pairs(nukes) do v:Destroy() end @@ -1763,7 +1763,7 @@ return function(Vargs, env) partsHit = nil finished = true elseif partsHit and objs and Variables.WildFire ~= partsHit then - for i,v in next,objs do + for i,v in pairs(objs) do v:Destroy() end @@ -1813,7 +1813,7 @@ return function(Vargs, env) end end - for i,v in next,Functions.GetPlayers(plr, args[1]) do + for i,v in pairs(Functions.GetPlayers(plr, args[1])) do local char = v.Character local human = char and char:FindFirstChild("HumanoidRootPart") if human then @@ -2703,7 +2703,7 @@ return function(Vargs, env) torso.Transparency = 1 - for i,v in next,torso:GetChildren() do + for i,v in ipairs(torso:GetChildren()) do if v:IsA'Motor6D' then local lc0 = service.New('CFrameValue', {Name='LastC0';Value=v.C0;Parent=v}) end @@ -4813,11 +4813,12 @@ return function(Vargs, env) Function = function(plr,args) for _, v in ipairs(service.GetPlayers(plr, args[1])) do if v.Character and v.Character.PrimaryPart then - local Explosion = service.New("Explosion") - Explosion.Position = v.Character.PrimaryPart.Position - Explosion.BlastRadius = args[2] or 20 - Explosion.Archivable = false - Explosion.Parent = workspace.Terrain + service.New("Explosion", { + Position = v.Character.PrimaryPart.Position, + BlastRadius = args[2] or 20, + Archivable = false, + Parent = workspace.Terrain + }) end end end diff --git a/MainModule/Server/Commands/Moderators.lua b/MainModule/Server/Commands/Moderators.lua index 3617f58ece..61c18b6560 100644 --- a/MainModule/Server/Commands/Moderators.lua +++ b/MainModule/Server/Commands/Moderators.lua @@ -3034,11 +3034,13 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) for i,v in pairs(service.GetPlayers(plr,args[1])) do - local hum = v.Character:FindFirstChildWhichIsA("Humanoid") - if hum then - hum.Health = 0 + if v.Character then + local hum = v.Character:FindFirstChildWhichIsA("Humanoid") + if hum then + hum.Health = 0 + end + v.Character:BreakJoints() end - v.Character:BreakJoints() end end }; diff --git a/MainModule/Server/Core/Anti.lua b/MainModule/Server/Core/Anti.lua index a666475940..71e7f23dbb 100644 --- a/MainModule/Server/Core/Anti.lua +++ b/MainModule/Server/Core/Anti.lua @@ -26,7 +26,7 @@ return function(Vargs) --// Client check service.StartLoop("ClientCheck",30, Anti.CheckAllClients, true) - + Anti.Init = nil; Logs:AddLog("Script", "AntiExploit Module Initialized") end @@ -182,7 +182,7 @@ return function(Vargs) local test = obj[testName] end) if err then - local class = err:match(testName.." is not a valid member of (.*)") + local class = string.match(err, testName.." is not a valid member of (.*)") if class then return class end @@ -209,9 +209,9 @@ return function(Vargs) warn("ANTI-EXPLOIT: "..player.Name.." "..action.." "..info) elseif service.NetworkServer then if player then - if action:lower() == 'log' then + if string.lower(action) == 'log' then -- yay? - elseif action:lower() == 'kick' then + elseif string.lower(action) == 'kick' then Anti.RemovePlayer(player, info) if Settings.AENotifs == true then for _, plr in pairs(service.Players:GetPlayers()) do @@ -225,11 +225,11 @@ return function(Vargs) end end end - + --player:Kick("Adonis; Disconnected by server; \n"..tostring(info)) - elseif action:lower() == 'kill' then + elseif string.lower(action) == 'kill' then player.Character:BreakJoints() - elseif action:lower() == 'crash' then + elseif string.lower(action) == 'crash' then Remote.Send(player,'Function','Kill') wait(5) pcall(function() @@ -251,7 +251,7 @@ return function(Vargs) end end end - + else -- fake log (thonk?) Anti.Detected(player, "Kick", "Spoofed log") diff --git a/MainModule/Server/Core/Core.lua b/MainModule/Server/Core/Core.lua index f94abb66de..8d68524a2d 100644 --- a/MainModule/Server/Core/Core.lua +++ b/MainModule/Server/Core/Core.lua @@ -104,13 +104,14 @@ return function(Vargs) DataCache = {}; PlayerData = {}; CrossServerCommands = {}; - CrossServer = function() return false end; + CrossServer = function(...) return false end; ExecuteScripts = {}; LastDataSave = 0; PanicMode = false; FixingEvent = false; ScriptCache = {}; Connections = {}; + BytecodeCache = {}; LastEventValue = 1; Variables = { @@ -130,8 +131,10 @@ return function(Vargs) }; Panic = function(reason) - local hint = Instance.new("Hint", service.Workspace) - hint.Text = "~= Adonis PanicMode Enabled: "..tostring(reason).." =~" + service.new("Hint", { + Text = "~= Adonis PanicMode Enabled: "..tostring(reason).." =~", + Parent = workspace, + }) Core.PanicMode = true; warn("SOMETHING SEVERE HAPPENED; ENABLING PANIC MODE; REASON BELOW;") @@ -524,7 +527,9 @@ return function(Vargs) end; Bytecode = function(str) - local f,buff = Core.Loadstring(str) + if Core.BytecodeCache[str] then return Core.BytecodeCache[str] end + local f, buff = Core.Loadstring(str) + Core.BytecodeCache[str] = buff return buff end; @@ -542,9 +547,11 @@ return function(Vargs) ScriptType.Name = "[Adonis] ".. type if allowCodes then - local exec = Instance.new("StringValue",ScriptType) - exec.Name = "Execute" - exec.Value = execCode + service.New("StringValue", { + Name = "Execute", + Value = execCode, + Parent = ScriptType, + }) end local wrapped = Core.RegisterScript { @@ -666,7 +673,7 @@ return function(Vargs) GetDataStore = function() local ran,store = pcall(function() - return service.DataStoreService:GetDataStore(Settings.DataStore:sub(1,50),"Adonis") + return service.DataStoreService:GetDataStore(string.sub(Settings.DataStore, 1, 50),"Adonis") end) return ran and store diff --git a/MainModule/Server/Core/Functions.lua b/MainModule/Server/Core/Functions.lua index ee08be4db2..90ff7aed77 100644 --- a/MainModule/Server/Core/Functions.lua +++ b/MainModule/Server/Core/Functions.lua @@ -34,7 +34,6 @@ return function(Vargs) Logs:AddLog("Script", "Functions Module RunAfterPlugins Finished"); end - local insert = table.insert server.Functions = { Init = Init; RunAfterPlugins = RunAfterPlugins; @@ -44,7 +43,7 @@ return function(Vargs) Prefix = true; Absolute = true; Function = function(msg, plr, parent, players, getplr, plus, isKicking) - insert(players,plr) + table.insert(players,plr) plus() end; }; @@ -63,7 +62,7 @@ return function(Vargs) local p = getplr(v) if sub(lower(p.Name), 1, #msg)==lower(msg) then everyone = false - insert(players,p) + table.insert(players,p) plus() end end @@ -73,7 +72,7 @@ return function(Vargs) for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p then - insert(players,p) + table.insert(players,p) plus() end end @@ -98,7 +97,7 @@ return function(Vargs) for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p ~= plr then - insert(players,p) + table.insert(players,p) plus() end end @@ -121,7 +120,7 @@ return function(Vargs) end end - insert(players,p) + table.insert(players,p) plus(); end; }; @@ -134,7 +133,7 @@ return function(Vargs) for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if Admin.CheckAdmin(p,false) then - insert(players, p) + table.insert(players, p) plus() end end @@ -149,7 +148,7 @@ return function(Vargs) for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if not Admin.CheckAdmin(p,false) then - insert(players,p) + table.insert(players,p) plus() end end @@ -164,7 +163,7 @@ return function(Vargs) for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p:IsFriendsWith(plr.userId) then - insert(players,p) + table.insert(players,p) plus() end end @@ -182,7 +181,7 @@ return function(Vargs) for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p and p.Name == matched then - insert(players,p) + table.insert(players,p) plus() foundNum = foundNum+1 end @@ -205,7 +204,7 @@ return function(Vargs) for k, m in ipairs(parent:GetChildren()) do local p = getplr(m) if p.TeamColor == v.TeamColor then - insert(players,p) + table.insert(players,p) plus() end end @@ -223,7 +222,7 @@ return function(Vargs) for _,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p:IsInGroup(tonumber(matched)) then - insert(players,p) + table.insert(players,p) plus() end end @@ -237,10 +236,10 @@ return function(Vargs) local matched = tonumber(string.match(msg, "id%-(.*)")) local foundNum = 0 if matched then - for _,v in next,parent:GetChildren() do + for _,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p and p.userId == matched then - insert(players,p) + table.insert(players,p) plus() foundNum += 1 end @@ -272,10 +271,10 @@ return function(Vargs) local foundNum = 0 if matched then - for _,v in next,parent:GetChildren() do + for _,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p and p.DisplayName == matched then - insert(players,p) + table.insert(players,p) plus() foundNum = foundNum+1 end @@ -297,7 +296,7 @@ return function(Vargs) for k,m in ipairs(parent:GetChildren()) do local p = getplr(m) if p.TeamColor == v.TeamColor then - insert(players, p) + table.insert(players, p) plus() end end @@ -317,7 +316,7 @@ return function(Vargs) for _,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p:IsInGroup(matched) then - insert(players,p) + table.insert(players,p) plus() end end @@ -375,10 +374,10 @@ return function(Vargs) return; end - for i,v in next,parent:GetChildren() do + for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p ~= plr and plr:DistanceFromCharacter(p.Character.Head.Position) <= num then - insert(players,p) + table.insert(players,p) plus() end end @@ -421,7 +420,7 @@ return function(Vargs) data[i] = v; end; - for i,v in next,data do fakePlayer:SetSpecial(i, v) end + for i,v in pairs(data) do fakePlayer:SetSpecial(i, v) end return fakePlayer; end; @@ -436,7 +435,7 @@ return function(Vargs) end; IsClass = function(obj, classList) - for _,class in next,classList do + for _,class in pairs(classList) do if obj:IsA(class) then return true end @@ -445,7 +444,7 @@ return function(Vargs) ArgsToString = function(args) local str = "" - for i,arg in next,args do + for i,arg in pairs(args) do str = str.."Arg"..tostring(i)..": "..tostring(arg).."; " end return str @@ -506,7 +505,7 @@ return function(Vargs) for _, v in ipairs(parent:GetChildren()) do local p = getplr(v) if p then - insert(players,p) + table.insert(players,p) end end elseif plr and not names then @@ -523,19 +522,19 @@ return function(Vargs) if matchFunc then matchFunc.Function(s, plr, parent, players, getplr, plus, isKicking, isServer, dontError) else - for i,v in next,parent:GetChildren() do + for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p and p.ClassName == "Player" and sub(lower(p.DisplayName), 1, #s) == lower(s) then - insert(players,p) + table.insert(players,p) plus() end end if plrs == 0 then - for i,v in next,parent:GetChildren() do + for i,v in ipairs(parent:GetChildren()) do local p = getplr(v) if p and p.ClassName == "Player" and sub(lower(p.Name), 1, #s) == lower(s) then - insert(players,p) + table.insert(players,p) plus() end end @@ -553,7 +552,7 @@ return function(Vargs) userId = tonumber(userid); }) - insert(players, fakePlayer) + table.insert(players, fakePlayer) plus() end end @@ -571,7 +570,7 @@ return function(Vargs) local filteredList = {}; local checkList = {}; - for i,v in next, players do + for i,v in pairs(players) do if not checkList[v] then table.insert(filteredList, v); checkList[v] = true; @@ -849,18 +848,18 @@ return function(Vargs) Props = props; Type = "Particle"; } - for i,v in next,service.Players:GetPlayers() do + for i,v in ipairs(service.Players:GetPlayers()) do Remote.NewParticle(v,target,type,props) end end; RemoveParticle = function(target,name) - for i,v in next,Variables.LocalEffects do + for i,v in pairs(Variables.LocalEffects) do if v.Type == "Particle" and v.Part == target and (v.Props.Name == name or v.Class == name) then Variables.LocalEffects[i] = nil end end - for i,v in next,service.Players:GetPlayers() do + for i,v in ipairs(service.Players:GetPlayers()) do Remote.RemoveParticle(v,target,name) end end; @@ -1109,7 +1108,7 @@ return function(Vargs) p:Kick("Server Shutdown\n\n".. tostring(reason or "No Reason Given")) end) - for i,p in next,service.Players:GetPlayers() do + for i,p in ipairs(service.Players:GetPlayers()) do p:Kick("Server Shutdown\n\n" .. tostring(reason or "No Reason Given")) end end; diff --git a/MainModule/Server/Core/Variables.lua b/MainModule/Server/Core/Variables.lua index 7fc21188c2..6f4c671a22 100644 --- a/MainModule/Server/Core/Variables.lua +++ b/MainModule/Server/Core/Variables.lua @@ -43,6 +43,7 @@ return function(Vargs) Logs:AddLog("Script", "Finished Variables AfterInit"); end + local Lighting = service.Lighting server.Variables = { Init = Init; RunAfterInit = AfterInit; @@ -57,38 +58,38 @@ return function(Vargs) DonorPass = {1348327, 1990427, 1911740, 167686, 98593, "6878510605"}; --// Strings are items, numbers are gamepasses WebPanel_Initiated = false; LightingSettings = { - Ambient = service.Lighting.Ambient; - OutdoorAmbient = service.Lighting.OutdoorAmbient; - Brightness = service.Lighting.Brightness; - TimeOfDay = service.Lighting.TimeOfDay; - FogColor = service.Lighting.FogColor; - FogEnd = service.Lighting.FogEnd; - FogStart = service.Lighting.FogStart; - GlobalShadows = service.Lighting.GlobalShadows; - Outlines = service.Lighting.Outlines; - ShadowColor = service.Lighting.ShadowColor; - ColorShift_Bottom = service.Lighting.ColorShift_Bottom; - ColorShift_Top = service.Lighting.ColorShift_Top; - GeographicLatitude = service.Lighting.GeographicLatitude; - Name = service.Lighting.Name; + Ambient = Lighting.Ambient; + OutdoorAmbient = Lighting.OutdoorAmbient; + Brightness = Lighting.Brightness; + TimeOfDay = Lighting.TimeOfDay; + FogColor = Lighting.FogColor; + FogEnd = Lighting.FogEnd; + FogStart = Lighting.FogStart; + GlobalShadows = Lighting.GlobalShadows; + Outlines = Lighting.Outlines; + ShadowColor = Lighting.ShadowColor; + ColorShift_Bottom = Lighting.ColorShift_Bottom; + ColorShift_Top = Lighting.ColorShift_Top; + GeographicLatitude = Lighting.GeographicLatitude; + Name = Lighting.Name; }; OriginalLightingSettings = { - Ambient = service.Lighting.Ambient; - OutdoorAmbient = service.Lighting.OutdoorAmbient; - Brightness = service.Lighting.Brightness; - TimeOfDay = service.Lighting.TimeOfDay; - FogColor = service.Lighting.FogColor; - FogEnd = service.Lighting.FogEnd; - FogStart = service.Lighting.FogStart; - GlobalShadows = service.Lighting.GlobalShadows; - Outlines = service.Lighting.Outlines; - ShadowColor = service.Lighting.ShadowColor; - ColorShift_Bottom = service.Lighting.ColorShift_Bottom; - ColorShift_Top = service.Lighting.ColorShift_Top; - GeographicLatitude = service.Lighting.GeographicLatitude; - Name = service.Lighting.Name; - Sky = service.Lighting:FindFirstChildOfClass("Sky") and service.Lighting:FindFirstChildOfClass("Sky"):Clone(); + Ambient = Lighting.Ambient; + OutdoorAmbient = Lighting.OutdoorAmbient; + Brightness = Lighting.Brightness; + TimeOfDay = Lighting.TimeOfDay; + FogColor = Lighting.FogColor; + FogEnd = Lighting.FogEnd; + FogStart = Lighting.FogStart; + GlobalShadows = Lighting.GlobalShadows; + Outlines = Lighting.Outlines; + ShadowColor = Lighting.ShadowColor; + ColorShift_Bottom = Lighting.ColorShift_Bottom; + ColorShift_Top = Lighting.ColorShift_Top; + GeographicLatitude = Lighting.GeographicLatitude; + Name = Lighting.Name; + Sky = Lighting:FindFirstChildOfClass("Sky") and Lighting:FindFirstChildOfClass("Sky"):Clone(); }; HelpRequests = {}; From e8ffa5becfbbbe7d6b24a35a13c702df9ead2bbb Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Sat, 2 Oct 2021 16:26:56 +0100 Subject: [PATCH 06/17] Update Service.lua --- MainModule/Server/Shared/Service.lua | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/MainModule/Server/Shared/Service.lua b/MainModule/Server/Shared/Service.lua index 7c3a7312f1..194e722c14 100644 --- a/MainModule/Server/Shared/Service.lua +++ b/MainModule/Server/Shared/Service.lua @@ -212,7 +212,7 @@ return function(errorHandler, eventChecker, fenceSpecific) end; ForEach = function(tab, func) - for i,v in next,tab do + for i,v in pairs(tab) do func(tab, i, v) end end; @@ -289,8 +289,7 @@ return function(errorHandler, eventChecker, fenceSpecific) end) event:SetSpecial("Fire", function(i, ...) - local packedResult = table.pack(...) - UnWrap(event):Fire(2, unpack(UnWrapArgs(packedResult), 1, packedResult.n)) + UnWrap(event):Fire(2, unpack(UnWrapArgs(...))) end) event:SetSpecial("ConnectOnce", function(i, func) @@ -305,15 +304,13 @@ return function(errorHandler, eventChecker, fenceSpecific) event:SetSpecial("Connect", function(i, func) local special = math.random() local event2 = Wrap(UnWrap(event.Event):Connect(function(con, ...) - local packedResult = table.pack(...) if con == 2 or con == special then - func(unpack(WrapArgs(packedResult), 1, packedResult.n)) + func(unpack(WrapArgs(...))) end end), client) event2:SetSpecial("Fire", function(i, ...) - local packedResult = table.pack(...) - UnWrap(event):Fire(special, unpack(UnWrapArgs(packedResult), 1, packedResult.n)) + UnWrap(event):Fire(special, unpack(...)) end) event2:SetSpecial("Wait", function(i, timeout) @@ -391,7 +388,6 @@ return function(errorHandler, eventChecker, fenceSpecific) Changed = {}; Timeout = timeout or 0; Running = false; - Function = func; R_Status = "Idle"; Finished = {}; Function = function(...) newTask.R_Status = "Running" newTask.Running = true local ret = {func(...)} newTask.R_Status = "Finished" newTask.Running = false newTask.Remove() return unpack(ret) end; @@ -470,7 +466,6 @@ return function(errorHandler, eventChecker, fenceSpecific) Running = coroutine.running; Create = coroutine.create; Start = coroutine.resume; - Wrap = coroutine.wrap; Get = coroutine.running; New = function(func) local new = coroutine.create(func) table.insert(service.Threads.Threads,new) return new end; End = function(thread) repeat if thread and service.Threads.Status(thread) ~= "dead" then service.Threads.Stop(thread) service.Threads.Resume(thread) else thread = false break end until not thread or service.Threads.Status(thread) == "dead" end; @@ -578,8 +573,7 @@ return function(errorHandler, eventChecker, fenceSpecific) connect = function(ignore, func) return Wrap(object:Connect(function(...) - local packedResult = table.pack(...) - return func(unpack(sWrap(packedResult), 1, packedResult.n)) + return func(unpack(sWrap(...))) end)) end; @@ -598,9 +592,8 @@ return function(errorHandler, eventChecker, fenceSpecific) return custom[ind] elseif type(target) == "function" then return function(ignore, ...) - local packedResult = table.pack(...) return unpack(Wrap({ - methods[ind](object, unpack(UnWrap(packedResult), 1, packedResult.n)) + methods[ind](object, unpack(UnWrap(...))) })) end else @@ -1167,9 +1160,8 @@ return function(errorHandler, eventChecker, fenceSpecific) wait(tonumber(mode)) end end; - ForEach = function(tab, func) for i,v in next,tab do func(tab,i,v) end return tab end; OrigRawEqual = rawequal; - ForEach = function(tab, func) for i,v in next,tab do func(tab,i,v) end return tab end; + ForEach = function(tab, func) for i,v in pairs(tab) do func(tab,i,v) end return tab end; HasItem = function(obj, prop) return pcall(function() return obj[prop] end) end; IsDestroyed = function(object) if type(object) == "userdata" and service.HasItem(object, "Parent") then From 4c5062b199e57855b07206727fb49fcbc769fccd Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Sat, 2 Oct 2021 16:29:48 +0100 Subject: [PATCH 07/17] Update Anti.lua --- MainModule/Server/Core/Anti.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MainModule/Server/Core/Anti.lua b/MainModule/Server/Core/Anti.lua index 71e7f23dbb..4a4d82ac90 100644 --- a/MainModule/Server/Core/Anti.lua +++ b/MainModule/Server/Core/Anti.lua @@ -267,7 +267,7 @@ return function(Vargs) }) Logs.AddLog(Logs.Exploit,{ - Text = "[Action: "..tostring(action).." User: (".. tostring(player) ..")] ".. tostring(info:sub(1, 50)) .. " (Mouse over full info)"; + Text = "[Action: "..tostring(action).." User: (".. tostring(player) ..")] ".. tostring(string.sub(info, 1, 50)) .. " (Mouse over full info)"; Desc = tostring(info); Player = player; }) From 7adc09562fa134a2507fa6a0e65b81ed4b3aa43e Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Sat, 2 Oct 2021 16:34:13 +0100 Subject: [PATCH 08/17] Revert "Update Service.lua" This reverts commit e8ffa5becfbbbe7d6b24a35a13c702df9ead2bbb. --- MainModule/Server/Shared/Service.lua | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/MainModule/Server/Shared/Service.lua b/MainModule/Server/Shared/Service.lua index 194e722c14..7c3a7312f1 100644 --- a/MainModule/Server/Shared/Service.lua +++ b/MainModule/Server/Shared/Service.lua @@ -212,7 +212,7 @@ return function(errorHandler, eventChecker, fenceSpecific) end; ForEach = function(tab, func) - for i,v in pairs(tab) do + for i,v in next,tab do func(tab, i, v) end end; @@ -289,7 +289,8 @@ return function(errorHandler, eventChecker, fenceSpecific) end) event:SetSpecial("Fire", function(i, ...) - UnWrap(event):Fire(2, unpack(UnWrapArgs(...))) + local packedResult = table.pack(...) + UnWrap(event):Fire(2, unpack(UnWrapArgs(packedResult), 1, packedResult.n)) end) event:SetSpecial("ConnectOnce", function(i, func) @@ -304,13 +305,15 @@ return function(errorHandler, eventChecker, fenceSpecific) event:SetSpecial("Connect", function(i, func) local special = math.random() local event2 = Wrap(UnWrap(event.Event):Connect(function(con, ...) + local packedResult = table.pack(...) if con == 2 or con == special then - func(unpack(WrapArgs(...))) + func(unpack(WrapArgs(packedResult), 1, packedResult.n)) end end), client) event2:SetSpecial("Fire", function(i, ...) - UnWrap(event):Fire(special, unpack(...)) + local packedResult = table.pack(...) + UnWrap(event):Fire(special, unpack(UnWrapArgs(packedResult), 1, packedResult.n)) end) event2:SetSpecial("Wait", function(i, timeout) @@ -388,6 +391,7 @@ return function(errorHandler, eventChecker, fenceSpecific) Changed = {}; Timeout = timeout or 0; Running = false; + Function = func; R_Status = "Idle"; Finished = {}; Function = function(...) newTask.R_Status = "Running" newTask.Running = true local ret = {func(...)} newTask.R_Status = "Finished" newTask.Running = false newTask.Remove() return unpack(ret) end; @@ -466,6 +470,7 @@ return function(errorHandler, eventChecker, fenceSpecific) Running = coroutine.running; Create = coroutine.create; Start = coroutine.resume; + Wrap = coroutine.wrap; Get = coroutine.running; New = function(func) local new = coroutine.create(func) table.insert(service.Threads.Threads,new) return new end; End = function(thread) repeat if thread and service.Threads.Status(thread) ~= "dead" then service.Threads.Stop(thread) service.Threads.Resume(thread) else thread = false break end until not thread or service.Threads.Status(thread) == "dead" end; @@ -573,7 +578,8 @@ return function(errorHandler, eventChecker, fenceSpecific) connect = function(ignore, func) return Wrap(object:Connect(function(...) - return func(unpack(sWrap(...))) + local packedResult = table.pack(...) + return func(unpack(sWrap(packedResult), 1, packedResult.n)) end)) end; @@ -592,8 +598,9 @@ return function(errorHandler, eventChecker, fenceSpecific) return custom[ind] elseif type(target) == "function" then return function(ignore, ...) + local packedResult = table.pack(...) return unpack(Wrap({ - methods[ind](object, unpack(UnWrap(...))) + methods[ind](object, unpack(UnWrap(packedResult), 1, packedResult.n)) })) end else @@ -1160,8 +1167,9 @@ return function(errorHandler, eventChecker, fenceSpecific) wait(tonumber(mode)) end end; + ForEach = function(tab, func) for i,v in next,tab do func(tab,i,v) end return tab end; OrigRawEqual = rawequal; - ForEach = function(tab, func) for i,v in pairs(tab) do func(tab,i,v) end return tab end; + ForEach = function(tab, func) for i,v in next,tab do func(tab,i,v) end return tab end; HasItem = function(obj, prop) return pcall(function() return obj[prop] end) end; IsDestroyed = function(object) if type(object) == "userdata" and service.HasItem(object, "Parent") then From b744640ec819ce631dfbebe417ae997adfb8962c Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Tue, 5 Oct 2021 00:35:35 +0100 Subject: [PATCH 09/17] improvements/optimizations --- MainModule/Server/Commands/HeadAdmins.lua | 25 ++- MainModule/Server/Commands/Moderators.lua | 208 +++++++++++----------- MainModule/Server/Core/Admin.lua | 6 +- MainModule/Server/Core/Core.lua | 10 +- MainModule/Server/Core/Process.lua | 11 +- MainModule/Server/Core/Remote.lua | 16 +- MainModule/Server/Shared/Service.lua | 64 ++++--- 7 files changed, 171 insertions(+), 169 deletions(-) diff --git a/MainModule/Server/Commands/HeadAdmins.lua b/MainModule/Server/Commands/HeadAdmins.lua index 288b872d5b..3fc1489e0e 100644 --- a/MainModule/Server/Commands/HeadAdmins.lua +++ b/MainModule/Server/Commands/HeadAdmins.lua @@ -14,25 +14,24 @@ return function(Vargs, env) Commands = {"tempban";"timedban";"timeban";"tban";"temporaryban"}; Args = {"player";"number";"reason"}; Hidden = false; - Filter = true; Description = "Bans the target player(s) for the supplied amount of time; Data Persistent; Undone using :untimeban"; Fun = false; AdminLevel = "HeadAdmins"; Function = function(plr,args,data) assert(args[1] and args[2], "Argument missing or nil") local time = args[2] - - if time:lower():sub(#time)=='s' then - time = time:sub(1,#time-1) + local lower, sub = string.lower, string.sub + if sub(lower(time), #time)=='s' then + time = sub(time, 1, #time-1) time = tonumber(time) - elseif time:lower():sub(#time)=='m' then - time = time:sub(1,#time-1) + elseif sub(lower(time), #time)=='m' then + time = sub(time, 1, #time-1) time = tonumber(time)*60 - elseif time:lower():sub(#time)=='h' then - time = time:sub(1,#time-1) - time = (tonumber(time)*60)*60 - elseif time:lower():sub(#time)=='d' then - time = time:sub(1,#time-1) + elseif sub(lower(time), #time)=='h' then + time = sub(time, 1, #time-1) + time = ((time)*60)*60 + elseif sub(lower(time), #time)=='d' then + time = sub(time, 1, #time-1) time = ((tonumber(time)*60)*60)*24 end @@ -49,7 +48,7 @@ return function(Vargs, env) }) do if level > Admin.GetLevel(v) then local endTime = os.time() + tonumber(time) - local reason = args[3] or "No reason provided"; + local reason = service.Filter(args[3], plr, v) or "No reason provided"; local data = { Name = v.Name; UserId = v.UserId; @@ -69,7 +68,7 @@ return function(Vargs, env) Value = data; }) - Functions.Hint("Banned "..tostring(v.Name).." for "..tostring(time),{plr}) + Functions.Hint("Banned "..tostring(v.Name).." for ".. tostring(time),{plr}) end end end diff --git a/MainModule/Server/Commands/Moderators.lua b/MainModule/Server/Commands/Moderators.lua index 61c18b6560..5a8bbde61f 100644 --- a/MainModule/Server/Commands/Moderators.lua +++ b/MainModule/Server/Commands/Moderators.lua @@ -904,7 +904,7 @@ return function(Vargs, env) assert(args[1] and args[2], "Argument missing") local messageRecipient = string.format("Message from %s (@%s)", plr.DisplayName, plr.Name) - if Admin.CheckAdmin(plr) and not args[2]:match("^%s*$") then + if Admin.CheckAdmin(plr) and not string.match(args[2],"^%s*$") then for _, v in ipairs(service.GetPlayers(plr, args[1])) do Variables.AuthorizedToReply[v] = true; Remote.MakeGui(v, "PrivateMessage", { @@ -1091,7 +1091,7 @@ return function(Vargs, env) for i,v in pairs(service.GetPlayers(plr,args[1])) do Routine(function() local tools = {} - table.insert(tools,{Text="==== "..v.Name.."'s Tools ====",Desc=v.Name:lower()}) + table.insert(tools,{Text="==== "..v.Name.."'s Tools ====",Desc=string.lower(v.Name)}) for k,t in pairs(v.Backpack:GetChildren()) do if t:IsA("Tool") then table.insert(tools,{Text=t.Name,Desc="Class: "..t.ClassName.." | ToolTip: "..t.ToolTip.." | Name: "..t.Name}) @@ -1146,9 +1146,9 @@ return function(Vargs, env) h = "NO CHARACTER/HUMANOID" end - table.insert(plrs,{Text = "["..ping.."] "..v.Name.. " (".. v.DisplayName ..")", Desc = 'Lower: '..v.Name:lower()..' - Health: '..h..((not hum and "") or " - MaxHealth: "..mh.." - WalkSpeed: "..ws.." - JumpPower: "..jp.." - Humanoid Name: "..hum.Name)}) + table.insert(plrs,{Text = "["..ping.."] "..v.Name.. " (".. v.DisplayName ..")", Desc = 'Lower: '..string.lower(v.Name)..' - Health: '..h..((not hum and "") or " - MaxHealth: "..mh.." - WalkSpeed: "..ws.." - JumpPower: "..jp.." - Humanoid Name: "..hum.Name)}) else - table.insert(plrs,{Text = '[LOADING] '..v.Name, Desc = 'Lower: '..v.Name:lower()..' - Ping: '..ping}) + table.insert(plrs,{Text = '[LOADING] '..v.Name, Desc = 'Lower: '..string.lower(v.Name)..' - Ping: '..ping}) end end end @@ -1189,7 +1189,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) for i,v in pairs(Variables.Waypoints) do - if i:lower():sub(1,#args[1])==args[1]:lower() or args[1]:lower()=='all' then + if string.sub(string.lower(i),1,#args[1])==string.lower(args[1]) or string.lower(args[1])=='all' then Variables.Waypoints[i]=nil Functions.Hint('Deleted waypoint '..i,{plr}) end @@ -1274,7 +1274,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) for i,v in pairs(Variables.Cameras) do - if v.Name:sub(1,#args[1]) == args[1] then + if string.sub(v.Name,1,#args[1]) == args[1] then Remote.Send(plr,'Function','SetView',v.Brick) end end @@ -1469,9 +1469,9 @@ return function(Vargs, env) if timer<=0 then timer=0.1 end if amount>50 then amount=50 end local command = args[3] - local name = plr.Name:lower() + local name = string.lower(plr.Name) assert(command, "Argument #1 needs to be supplied") - if command:sub(1,#Settings.Prefix+string.len("repeat")):lower() == string.lower(Settings.Prefix.."repeat") or command:sub(1,#Settings.Prefix+string.len("loop")) == string.lower(Settings.Prefix.."loop") or command:find("^"..Settings.Prefix.."loop") or command:find("^"..Settings.Prefix.."repeat") then + if strng.lower(string.sub(command,1,#Settings.Prefix+string.len("repeat"))) == string.lower(Settings.Prefix.."repeat") or string.sub(command,1,#Settings.Prefix+string.len("loop")) == string.lower(Settings.Prefix.."loop") or command:find("^"..Settings.Prefix.."loop") or command:find("^"..Settings.Prefix.."repeat") then error("Cannot repeat the loop command in a loop command") return end @@ -1494,9 +1494,9 @@ return function(Vargs, env) Description = "Aborts a looped command. Must supply name of player who started the loop or \"me\" if it was you, or \"all\" for all loops. :abort sceleratis :kill bob or :abort all"; AdminLevel = "Moderators"; Function = function(plr,args) - local name = args[1]:lower() + local name = string.lower(args[1]) if name=="me" then - Variables.CommandLoops[plr.Name:lower()..args[2]] = nil + Variables.CommandLoops[string.lower(plr.Name)..args[2]] = nil elseif name=="all" then for i,v in pairs(Variables.CommandLoops) do Variables.CommandLoops[i] = nil @@ -1514,17 +1514,17 @@ return function(Vargs, env) Description = "Aborts all existing command loops"; AdminLevel = "Moderators"; Function = function(plr,args) - local name = args[1] and args[1]:lower() + local name = args[1] and string.lower(args[1]) if name and name=="me" then for i,v in ipairs(Variables.CommandLoops) do - if i:sub(1,plr.Name):lower() == plr.Name:lower() then - Variables.CommandLoops[plr.Name:lower()..args[2]] = nil + if string.lower(string.sub(i,1,plr.Name)) == string.lower(plr.Name) then + Variables.CommandLoops[string.lower(plr.Name)..args[2]] = nil end end elseif name and name=="all" then for i,v in ipairs(Variables.CommandLoops) do - Variables.CommandLoops[plr.Name:lower()..args[2]] = nil + Variables.CommandLoops[string.lower(plr.Name)..args[2]] = nil end elseif args[2] then if Variables.CommandLoops[name..args[2]] then @@ -1611,7 +1611,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) if args[1] then - for i,v in next,Functions.GetPlayers(plr, args[1]) do + for i,v in ipairs(service.GetPlayers(plr,args[1])) do local temp = {} local cTasks = Remote.Get(v, "TaskManager", "GetTasks") or {} @@ -1872,7 +1872,7 @@ return function(Vargs, env) if not answers then anstab = {"Yes","No"} else - for ans in answers:gmatch("([^,]+)") do + for ans in string.gmatch(answers,"([^,]+)") do table.insert(anstab,ans) end end @@ -2015,7 +2015,7 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - for i,v in next,service.GetPlayers(plr, args[1]) do + for i,v in ipairs(service.GetPlayers(plr,args[1])) do local piano = Deps.Assets.Piano:clone() piano.Parent = v:FindFirstChild("PlayerGui") or v.Backpack piano.Disabled = false @@ -2140,7 +2140,7 @@ return function(Vargs, env) Description = "Shows all instances created client-side by Adonis"; AdminLevel = "Moderators"; Function = function(plr,args) - for i,v in next,Functions.GetPlayers(plr, args[1]) do + for i,v in ipairs(service.GetPlayers(plr,args[1])) do local instList = Remote.Get(v, "InstanceList") if instList then Remote.MakeGui(plr, "List", { @@ -2165,7 +2165,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) for i,v in pairs(service.GetPlayers(plr,args[1] or "all")) do - if tostring(args[2]):lower() == "yes" or tostring(args[2]):lower() == "true" then + if string.lower(tostring(args[2])) == "yes" or string.lower(tostring(args[2])) == "true" then Routine(Remote.RemoveGui, v, true) else Routine(function() @@ -2249,7 +2249,7 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - for i, v in pairs(service.GetPlayers(plr, args[1]:lower())) do + for i, v in pairs(service.GetPlayers(plr, string.lower(args[1]))) do cPcall(function() if v and v:FindFirstChild("leaderstats") then for a,q in pairs(v.leaderstats:GetChildren()) do @@ -2309,7 +2309,7 @@ return function(Vargs, env) local id = args[5] if args[2] and not args[3] then for k,cape in pairs(Variables.Capes) do - if args[2]:lower()==cape.Name:lower() then + if string.lower(args[2])==string.lower(cape.Name) then color = cape.Color mat = cape.Material ref = cape.Reflectance @@ -2553,7 +2553,7 @@ return function(Vargs, env) if not found then for i,v in next,Variables.Jails do - if v.Name:lower():sub(1,#args[1]) == args[1]:lower() then + if string.sub(string.lower(v.Name),1,#args[1]) == string.lower(args[1]) then local ind = v.Index service.StopLoop(ind.."JAIL") Pcall(function() v.Jail:Destroy() end) @@ -2574,16 +2574,16 @@ return function(Vargs, env) local color = Enum.ChatColor.Red if not args[2] then color = Enum.ChatColor.Red - elseif args[2]:lower()=='red' then + elseif string.lower(args[2])=='red' then color = Enum.ChatColor.Red - elseif args[2]:lower()=='green' then + elseif string.lower(args[2])=='green' then color = Enum.ChatColor.Green - elseif args[2]:lower()=='blue' then + elseif string.lower(args[2])=='blue' then color = Enum.ChatColor.Blue - elseif args[2]:lower()=='off' then + elseif string.lower(args[2])=='off' then color = "off" end - for i,v in next,service.GetPlayers(plr,(args[1] or plr.Name)) do + for i,v in ipairs(service.GetPlayers(plr,(args[1] or plr.Name))) do Remote.MakeGui(v,"BubbleChat",{Color = color}) end end @@ -2662,7 +2662,7 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - if args[1]:lower() == Settings.SpecialPrefix.."all" then + if string.lower(args[1]) == Settings.SpecialPrefix.."all" then Remote.RemoveLocal(plr,'Tracker',false,true) else for i,v in pairs(service.GetPlayers(plr,args[1])) do @@ -2949,7 +2949,7 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - for i,p in next,service.GetPlayers(plr, args[1]) do + for i,p in ipairs(service.GetPlayers(plr, args[1])) do task.defer(function() local oChar = p.Character; local oTools, pBackpack, oHumanoid, oPrimary, oPos; @@ -2966,18 +2966,15 @@ return function(Vargs, env) --// Handle tool saving pBackpack = p:FindFirstChildOfClass("Backpack") + local ev if pBackpack then oTools = {}; - - if oHumanoid then - oHumanoid:UnequipTools() - end - - pBackpack.ChildAdded:Connect(function(c) + ev = pBackpack.ChildAdded:Connect(function(c) table.insert(oTools, c); c.Parent = nil; end) + if oHumanoid then oHumanoid:UnequipTools() end for _, Child in ipairs(pBackpack:GetChildren()) do table.insert(oTools, Child); Child.Parent = nil; @@ -2987,6 +2984,7 @@ return function(Vargs, env) --// Handle respawn and repositioning local newChar, newHumanoid, newPrimary; task.delay(0.1, pcall, p.LoadCharacter, p) + if ev then ev:Disconnect() end --// Reposition if possible if oPos then @@ -3170,9 +3168,9 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - for i, v in next,service.GetPlayers(plr,args[1]) do + for i, v in ipairs(service.GetPlayers(plr,args[1])) do if v.Character then - for a, obj in next,v.Character:GetChildren() do + for a, obj in ipairs(v.Character:GetChildren()) do if obj:IsA("BasePart") then obj.Transparency = 1 if obj:FindFirstChild("face") then @@ -3203,9 +3201,9 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - for i, v in next,service.GetPlayers(plr,args[1]) do + for i, v in ipairs(service.GetPlayers(plr,args[1])) do if v.Character then - for a, obj in next,v.Character:GetChildren() do + for a, obj in ipairs(v.Character:GetChildren()) do if obj:IsA("BasePart") and obj.Name~='HumanoidRootPart' then obj.Transparency = 0 if obj:FindFirstChild("face") then @@ -3397,7 +3395,7 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - if args[1]:lower()=='on' or args[1]:lower()=="true" then + if string.lower(args[1])=='on' or string.lower(args[1])=="true" then if args[2] then for i,v in pairs(service.GetPlayers(plr,args[2])) do Remote.SetLighting(v,"GlobalShadows",true) @@ -3405,7 +3403,7 @@ return function(Vargs, env) else Functions.SetLighting("GlobalShadows",true) end - elseif args[1]:lower()=='off' or args[1]:lower()=="false" then + elseif string.lower(args[1])=='off' or string.lower(args[1])=="false" then if args[2] then for i,v in pairs(service.GetPlayers(plr,args[2])) do Remote.SetLighting(v,"GlobalShadows",false) @@ -3426,7 +3424,7 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - if args[1]:lower()=='on' or args[1]:lower()=="true" then + if string.lower(args[1])=='on' or string.lower(args[1])=="true" then if args[2] then for i,v in pairs(service.GetPlayers(plr,args[2])) do Remote.SetLighting(v,"Outlines",true) @@ -3434,7 +3432,7 @@ return function(Vargs, env) else Functions.SetLighting("Outlines",true) end - elseif args[1]:lower()=='off' or args[1]:lower()=="false" then + elseif string.lower(args[1])=='off' or string.lower(args[1])=="false" then if args[2] then for i,v in pairs(service.GetPlayers(plr,args[2])) do Remote.SetLighting(v,"Outlines",false) @@ -3540,7 +3538,7 @@ return function(Vargs, env) local temp = service.New("Folder") for a, tool in pairs(Settings.Storage:GetChildren()) do if tool:IsA("Tool") or tool:IsA("HopperBin") then - if args[2]:lower() == "all" or tool.Name:lower():sub(1,#args[2])==args[2]:lower() then + if string.lower(args[2]) == "all" or string.sub(string.lower(tool.Name),1,#args[2])==string.lower(args[2]) then tool.Archivable = true local parent = tool.Parent if not parent.Archivable then @@ -3575,11 +3573,11 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - for i, v in pairs(service.GetPlayers(plr, args[1]:lower())) do + for i, v in pairs(service.GetPlayers(plr, string.lower(args[1]))) do if v:FindFirstChild("StarterGear") then for a,tool in pairs(v.StarterGear:GetChildren()) do if tool:IsA("Tool") or tool:IsA("HopperBin") then - if args[2]:lower() == "all" or tool.Name:lower():find(args[2]:lower()) == 1 then + if string.lower(args[2]) == "all" or string.find(string.lower(tool.Name), string.lower(args[2])) == 1 then tool:Destroy() end end @@ -3602,7 +3600,7 @@ return function(Vargs, env) local temp = service.New("Folder") for a, tool in pairs(Settings.Storage:GetChildren()) do if tool:IsA("Tool") or tool:IsA("HopperBin") then - if args[2]:lower() == "all" or tool.Name:lower():sub(1,#args[2])==args[2]:lower() then + if string.lower(args[2]) == "all" or string.sub(string.lower(tool.Name), 1, #args[2])==string.lower(args[2]) then tool.Archivable = true local parent = tool.Parent if not parent.Archivable then @@ -3829,8 +3827,8 @@ return function(Vargs, env) Function = function(plr,args) assert(args[1] and args[2],"Argument missing or nil") for i,v in pairs(service.GetPlayers(plr,args[1])) do - for a, tm in pairs(service.Teams:GetChildren()) do - if tm.Name:lower():sub(1,#args[2]) == args[2]:lower() then + for a, tm in ipairs(service.Teams:GetChildren()) do + if string.sub(string.lower(tm.Name),1,#args[2]) == string.lower(args[2]) then v.Team = tm end end @@ -3873,16 +3871,16 @@ return function(Vargs, env) end if args[2] then - for s in args[2]:gmatch("(%w+)") do + for s in string.gmatch(args[2], "(%w+)") do table.insert(tArgs,s) end end - for i,team in pairs(service.Teams:GetChildren()) do + for i,team in ipairs(service.Teams:GetChildren()) do if #tArgs > 0 then for ind,check in pairs(tArgs) do - if team.Name:lower():sub(1,#check) == check:lower() then + if string.sub(string.lower(team.Name),1,#check) == string.lower(check) then table.insert(teams,team) end end @@ -3925,7 +3923,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) assert(args[1] and args[2] and tonumber(args[2]), "Argument missing or invalid") - for i,v in next,service.GetPlayers(plr, args[1]) do + for i,v in ipairs(service.GetPlayers(plr,args[1])) do Remote.LoadCode(v,[[workspace.CurrentCamera.FieldOfView=]].. math.clamp(tonumber(args[2]), 1, 120)) end end @@ -4057,12 +4055,12 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args) - if args[2]:match('^waypoint%-(.*)') or args[2]:match('wp%-(.*)') then - local m = args[2]:match('^waypoint%-(.*)') or args[2]:match('wp%-(.*)') + if string.match(args[2], '^waypoint%-(.*)') or string.match(args[2], 'wp%-(.*)') then + local m = string.match(args[2], '^waypoint%-(.*)') or string.match(args[2], 'wp%-(.*)') local point for i,v in pairs(Variables.Waypoints) do - if i:lower():sub(1,#m)==m:lower() then + if string.sub(string.lower(i),1,#m)==string.lower(m) then point=v end end @@ -4083,7 +4081,7 @@ return function(Vargs, env) if not point then Functions.Hint('Waypoint '..m..' was not found.',{plr}) end elseif args[2]:find(',') then - local x,y,z = args[2]:match('(.*),(.*),(.*)') + local x,y,z = string.match(args[2],'(.*),(.*),(.*)') for i,v in pairs(service.GetPlayers(plr,args[1])) do if v.Character.Humanoid.SeatPart~=nil then Functions.RemoveSeatWelds(v.Character.Humanoid.SeatPart) @@ -4173,7 +4171,7 @@ return function(Vargs, env) for i,v in pairs(service.GetPlayers(plr,args[1])) do if v:FindFirstChild("leaderstats") then for a, st in pairs(v.leaderstats:GetChildren()) do - if st.Name:lower():find(args[2]:lower()) == 1 then + if string.find(string.lower(st.Name), string.lower(args[2])) == 1 then st.Value = args[3] end end @@ -4194,7 +4192,7 @@ return function(Vargs, env) for i,v in pairs(service.GetPlayers(plr,args[1])) do if v:FindFirstChild("leaderstats") then for a, st in pairs(v.leaderstats:GetChildren()) do - if st.Name:lower():find(args[2]:lower()) == 1 and tonumber(st.Value) then + if string.find(string.lower(st.Name),string.lower(args[2])) == 1 and tonumber(st.Value) then st.Value = tonumber(st.Value)+tonumber(args[3]) end end @@ -4215,7 +4213,7 @@ return function(Vargs, env) for i,v in pairs(service.GetPlayers(plr,args[1])) do if v:FindFirstChild("leaderstats") then for a, st in pairs(v.leaderstats:GetChildren()) do - if st.Name:lower():find(args[2]:lower()) == 1 and tonumber(st.Value) then + if string.find(string.lower(st.Name),string.lower(args[2])) == 1 and tonumber(st.Value) then st.Value = tonumber(st.Value)-tonumber(args[3]) end end @@ -4342,7 +4340,7 @@ return function(Vargs, env) local loop = true for i,v in pairs(Variables.MusicList) do - if id==v.Name:lower() then + if id==string.lower(v.Name) then id = v.ID if v.Pitch then pitch = v.Pitch @@ -4353,14 +4351,16 @@ return function(Vargs, env) end end - for i,v in pairs(HTTP.Trello.Music) do - if id==v.Name:lower() then - id = v.ID - if v.Pitch then - pitch = v.Pitch - end - if v.Volume then - volume = v.Volume + if #HTTP.Trello.Music ~= 0 then + for i,v in pairs(HTTP.Trello.Music) do + if id==string.lower(v.Name) then + id = v.ID + if v.Pitch then + pitch = v.Pitch + end + if v.Volume then + volume = v.Volume + end end end end @@ -4406,7 +4406,7 @@ return function(Vargs, env) SoundId = "rbxassetid://"..args[2]; }) - for i,v in next,Functions.GetPlayers(plr, args[1]) do + for i,v in ipairs(service.GetPlayers(plr,args[1])) do local char = v.Character local rootPart = char and char:FindFirstChild("HumanoidRootPart") if rootPart then @@ -4425,7 +4425,7 @@ return function(Vargs, env) Description = "Removes audio placed into character via :charaudio command"; AdminLevel = "Moderators"; Function = function(plr, args) - for i,v in next,Functions.GetPlayers(plr, args[1]) do + for i,v in ipairs(service.GetPlayers(plr,args[1])) do local char = v.Character local rootPart = char and char:FindFirstChild("HumanoidRootPart") if rootPart then @@ -4491,10 +4491,10 @@ return function(Vargs, env) local pitch = args[1] for i,v in ipairs(workspace:GetChildren()) do if v.Name=="ADONIS_SOUND" then - if args[1]:sub(1,1) == "+" then - v.Pitch=v.Pitch+tonumber(args[1]:sub(2)) - elseif args[1]:sub(1,1) == "-" then - v.Pitch=v.Pitch-tonumber(args[1]:sub(2)) + if string.sub(args[1],1,1) == "+" then + v.Pitch=v.Pitch+tonumber(string.sub(args[1],2)) + elseif string.sub(args[1],1,1) == "-" then + v.Pitch=v.Pitch-tonumber(string.sub(args[1],2)) else v.Pitch = pitch end @@ -4515,10 +4515,10 @@ return function(Vargs, env) assert(volume, "Volume must be a valid number") for i,v in ipairs(workspace:GetChildren()) do if v.Name=="ADONIS_SOUND" then - if args[1]:sub(1,1) == "+" then - v.Volume=v.Volume+tonumber(args[1]:sub(2)) - elseif args[1]:sub(1,1) == "-" then - v.Volume=v.Volume-tonumber(args[1]:sub(2)) + if string.sub(args[1],1,1) == "+" then + v.Volume=v.Volume+tonumber(string.sub(args[1],2)) + elseif string.sub(args[1],1,1) == "-" then + v.Volume=v.Volume-tonumber(string.sub(args[1],2)) else v.Volume = volume end @@ -4539,11 +4539,11 @@ return function(Vargs, env) service.StopLoop("MusicShuffle") Admin.RunCommand(Settings.Prefix.."stopmusic") if not args[1] then error("Missing argument") end - if args[1]:lower()~="off" then + if string.lower(args[1])~="off" then local idList = {} - for ent in args[1]:gmatch("[^%s,]+") do - local id,pitch = ent:match("(.*):(.*)") + for ent in string.gmatch(args[1],"[^%s,]+") do + local id,pitch = string.match(ent,"(.*):(.*)") if id then id = tonumber(id) else @@ -4594,7 +4594,7 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args,data) - local id = args[1]:lower() + local id = string.lower(args[1]) local looped = args[2] local pitch = tonumber(args[3]) or 1 local mp = service.MarketPlace @@ -4613,7 +4613,7 @@ return function(Vargs, env) end for i,v in pairs(Variables.MusicList) do - if id == v.Name:lower() then + if id == string.lower(v.Name) then id = v.ID if v.Pitch then @@ -4626,7 +4626,7 @@ return function(Vargs, env) end for i,v in pairs(HTTP.Trello.Music) do - if id == v.Name:lower() then + if id == string.lower(v.Name) then id = v.ID if v.Pitch then @@ -4749,7 +4749,7 @@ return function(Vargs, env) scr.Name = "ADONIS_FLIGHT" - for i,v in next,Functions.GetPlayers(plr, args[1]) do + for i,v in ipairs(service.GetPlayers(plr,args[1])) do local part = v.Character:FindFirstChild("HumanoidRootPart") if part then local oldp = part:FindFirstChild("ADONIS_FLIGHT_POSITION") @@ -4796,7 +4796,7 @@ return function(Vargs, env) Function = function(plr,args,noclip) local speed = tonumber(args[2]) - for i,v in next,Functions.GetPlayers(plr, args[1]) do + for i,v in ipairs(service.GetPlayers(plr,args[1])) do local part = v.Character:FindFirstChild("HumanoidRootPart") if part then local scr = part:FindFirstChild("ADONIS_FLIGHT") @@ -4918,7 +4918,7 @@ return function(Vargs, env) local char = v.Character; local human = char and char:FindFirstChildOfClass("Humanoid"); if human then - if args[2]:lower() == 'hide' then + if string.lower(args[2]) == 'hide' then human.DisplayName = '' Remote.MakeGui(v,"Notification",{ Title = "Notification"; @@ -4991,7 +4991,7 @@ return function(Vargs, env) wait() hum.Health=v.Character.Humanoid.Health - if args[2]:lower()=='hide' then + if string.lower(args[2])=='hide' then mod.Name = '' hum.MaxHealth = 0 hum.Health = 0 @@ -5096,7 +5096,7 @@ return function(Vargs, env) local suc,ers = pcall(function() return service.AssetService:GetBundleDetailsAsync(id) end) if suc then - for _, item in next, ers.Items do + for _, item in pairs(ers.Items) do if item.Type == "UserOutfit" then local s,r = pcall(function() return service.Players:GetHumanoidDescriptionFromOutfitId(item.Id) end) Variables.BundleCache[id] = r @@ -5150,7 +5150,7 @@ return function(Vargs, env) assert(args[1], "Argument #1 must be filled") assert(args[2], "Argument #2 must be filled") - local target = tonumber(args[2]:match("^userid%-(%d*)")) + local target = tonumber(string.match(args[2],"^userid%-(%d*)")) if not target then -- Grab id from name local success, id = pcall(service.Players.GetUserIdFromNameAsync, service.Players, args[2]) @@ -5249,7 +5249,7 @@ return function(Vargs, env) local temp = {} local auto - if args[1] and type(args[1]) == "string" and (args[1]:lower() == "yes" or args[1]:lower() == "true") then + if args[1] and type(args[1]) == "string" and (string.lower(args[1]) == "yes" or string.lower(args[1]) == "true") then auto = 1 end @@ -5285,7 +5285,7 @@ return function(Vargs, env) NoFilter = true; Function = function(plr,args) local auto - if args[2] and type(args[2]) == "string" and (args[2]:lower() == "yes" or args[2]:lower() == "true") then + if args[2] and type(args[2]) == "string" and (string.lower(args[2]) == "yes" or string.lower(args[2]) == "true") then auto = 1 end @@ -5316,7 +5316,7 @@ return function(Vargs, env) Function = function(plr,args) local tab = {} local auto - if args[1] and type(args[1]) == "string" and (args[1]:lower() == "yes" or args[1]:lower() == "true") then + if args[1] and type(args[1]) == "string" and (string.lower(args[1]) == "yes" or string.lower(args[1]) == "true") then auto = 1 end for i,v in pairs(Logs.Errors) do @@ -5345,7 +5345,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) local auto - if args[1] and type(args[1]) == "string" and (args[1]:lower() == "yes" or args[1]:lower() == "true") then + if args[1] and type(args[1]) == "string" and (string.lower(args[1]) == "yes" or string.lower(args[1]) == "true") then auto = 1 end Remote.MakeGui(plr,'List',{ @@ -5370,7 +5370,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) local auto - if args[1] and type(args[1]) == "string" and (args[1]:lower() == "yes" or args[1]:lower() == "true") then + if args[1] and type(args[1]) == "string" and (string.lower(args[1]) == "yes" or string.lower(args[1]) == "true") then auto = 1 end Remote.MakeGui(plr,'List',{ @@ -5392,7 +5392,7 @@ return function(Vargs, env) Function = function(plr,args) local auto - if args[1] and type(args[1]) == "string" and (args[1]:lower() == "yes" or args[1]:lower() == "true") then + if args[1] and type(args[1]) == "string" and (string.lower(args[1]) == "yes" or string.lower(args[1]) == "true") then auto = 1 end @@ -5416,7 +5416,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) local auto - if args[1] and type(args[1]) == "string" and (args[1]:lower() == "yes" or args[1]:lower() == "true") then + if args[1] and type(args[1]) == "string" and (string.lower(args[1]) == "yes" or string.lower(args[1]) == "true") then auto = 1 end Remote.MakeGui(plr,"List",{ @@ -5439,7 +5439,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) local auto - if args[1] and type(args[1]) == "string" and (args[1]:lower() == "yes" or args[1]:lower() == "true") then + if args[1] and type(args[1]) == "string" and (string.lower(args[1]) == "yes" or string.lower(args[1]) == "true") then auto = 1 end Remote.MakeGui(plr,"List",{ @@ -5464,7 +5464,7 @@ return function(Vargs, env) local auto local temp = {} - if args[1] and type(args[1]) == "string" and (args[1]:lower() == "yes" or args[1]:lower() == "true") then + if args[1] and type(args[1]) == "string" and (string.lower(args[1]) == "yes" or string.lower(args[1]) == "true") then auto = 1 end @@ -5494,7 +5494,7 @@ return function(Vargs, env) local auto local temp = {} - if args[1] and type(args[1]) == "string" and (args[1]:lower() == "yes" or args[1]:lower() == "true") then + if args[1] and type(args[1]) == "string" and (string.lower(args[1]) == "yes" or string.lower(args[1]) == "true") then auto = 1 end @@ -5533,7 +5533,7 @@ return function(Vargs, env) Fun = false; AdminLevel = "Moderators"; Function = function(plr,args,data) - for i,v in next,service.GetPlayers(plr,args[1]) do + for i,v in ipairs(service.GetPlayers(plr,args[1])) do if data.PlayerData.Level>Admin.GetLevel(v) then --Remote.LoadCode(v,[[service.StarterGui:SetCoreGuiEnabled("Chat",false) client.Variables.ChatEnabled = false client.Variables.Muted = true]]) local check = true @@ -5824,9 +5824,9 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) assert(args[1] and args[2], "Argument missing or nil") - assert(args[2]:lower() == "true" or args[2]:lower() == "false", "Invalid argument #2 (boolean expected)") + assert(string.lower(args[2]) == "true" or string.lower(args[2]) == "false", "Invalid argument #2 (boolean expected)") for i,v in pairs(service.GetPlayers(plr,args[1])) do - Remote.LoadCode(v,"service.StarterGui:SetCore('ResetButtonCallback',"..args[2]:lower()..")") + Remote.LoadCode(v,"service.StarterGui:SetCore('ResetButtonCallback',"..string.lower(args[2])..")") end end }; diff --git a/MainModule/Server/Core/Admin.lua b/MainModule/Server/Core/Admin.lua index 3475c65224..25b724fb02 100644 --- a/MainModule/Server/Core/Admin.lua +++ b/MainModule/Server/Core/Admin.lua @@ -164,7 +164,7 @@ return function(Vargs) local numArgs = 0; --local cmdArgs = - for arg in aliasCmd:gmatch("<(%S+)>") do + for arg in string.gmatch(aliasCmd, "<(%S+)>") do if arg ~= "" and arg ~= " " then local arg = "<".. arg ..">" if not uniqueArgs[arg] then --// Get only unique placeholder args, repeats will be matched to the same arg pos @@ -181,7 +181,7 @@ return function(Vargs) for i,argType in next,argTab do local replaceWith = suppliedArgs[i] if replaceWith then - out = out:gsub(argType, replaceWith) + out = string.gsub(out, argType, replaceWith) end end @@ -206,7 +206,7 @@ return function(Vargs) DoHideChatCmd = function(p, message, data) local pData = data or Core.GetPlayer(p); if pData.Client.HideChatCommands then - if Variables.BlankPrefix and + if Variables.BlankPrefix and (string.sub(message,1,1) ~= Settings.Prefix or string.sub(message,1,1) ~= Settings.PlayerPrefix) then local isCMD = Admin.GetCommand(message) if isCMD then diff --git a/MainModule/Server/Core/Core.lua b/MainModule/Server/Core/Core.lua index 8d68524a2d..6eec84a27d 100644 --- a/MainModule/Server/Core/Core.lua +++ b/MainModule/Server/Core/Core.lua @@ -641,7 +641,7 @@ return function(Vargs) Core.SetData(key, data) Logs.AddLog(Logs.Script,{ - Text = "Saved data for "..tostring(p); + Text = "Saved data for ".. p.Name; Desc = "Player data was saved to the datastore"; }) @@ -651,11 +651,12 @@ return function(Vargs) end; SaveAllPlayerData = function(queueWaitTime) + local TrackTask = service.TrackTask for key,pdata in pairs(Core.PlayerData) do local id = tonumber(key); local player = id and service.Players:GetPlayerByUserId(id); if player and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then - service.TrackTask(string.format("Save data for %s", player.Name), Core.SavePlayerData, player); + TrackTask(string.format("Save data for %s", player.Name), Core.SavePlayerData, player); end end --[[ --// OLD METHOD (Kept in case this messes anything up) @@ -751,9 +752,10 @@ return function(Vargs) local ran, ret = Core.DS_WriteLimiter("Write", Core.DataStore.SetAsync, Core.DataStore, Core.DataStoreEncode(key), value) if ran then Core.DataCache[key] = value + return; else logError("DataStore SetAsync Failed: ".. tostring(ret)); - error(ret); + return error(ret); end task.wait(6) @@ -787,7 +789,7 @@ return function(Vargs) if not ran then err = ret; logError("DataStore UpdateAsync Failed: ".. tostring(ret)) - error(ret); + return error(ret); end wait(6) diff --git a/MainModule/Server/Core/Process.lua b/MainModule/Server/Core/Process.lua index 2eea97deab..a0510a2af8 100644 --- a/MainModule/Server/Core/Process.lua +++ b/MainModule/Server/Core/Process.lua @@ -663,10 +663,12 @@ return function(Vargs) service.Events.PlayerRemoving:Fire(p) - local level = (p and Admin.GetLevel(p)) or 0 - if Settings.AntiNil and level < 1 then - pcall(function() service.UnWrap(p):Kick("Anti Nil") end) - end + spawn(function() + local level = (p and data.AdminLevel) or 0 + if Settings.AntiNil and level < 1 then + pcall(function() local p = service.UnWrap(p) p:Kick("Anti Nil") wait() if p then pcall(service.Delete, p) end end) + end + end) delay(1, function() if not service.Players:GetPlayerByUserId(p.UserId) then @@ -681,6 +683,7 @@ return function(Vargs) }) Core.SavePlayerData(p, data) + return; end; FinishLoading = function(p) diff --git a/MainModule/Server/Core/Remote.lua b/MainModule/Server/Core/Remote.lua index e9e66119c9..b792da9833 100644 --- a/MainModule/Server/Core/Remote.lua +++ b/MainModule/Server/Core/Remote.lua @@ -677,6 +677,8 @@ return function(Vargs) else Anti.Detected(p, "Log", "Client sent incorrect check data") end + + return; end; --[[Session = function(p,args) @@ -1102,18 +1104,16 @@ return function(Vargs) CheckKeys = function() --// Check all keys for ones no longer in use for >10 minutes (so players who actually left aren't tracked forever) - for key, data in next,Remote.Clients do + for key, data in pairs(Remote.Clients) do local continue = true; if data.Player and data.Player.Parent == service.Players then continue = false; else - for i,player in ipairs(service.Players:GetPlayers()) do - if tonumber(key) == player.UserId then - data.Player = player; - continue = false; - break; - end + local Player = service.Players:GetPlayerByUserId(key) + if Player then + data.Player = Player + continue = false end end @@ -1123,6 +1123,8 @@ return function(Vargs) Logs:AddLog("Script", "Client key removed for UserId ".. tostring(key)) end end + + return; end; Ping = function(p) diff --git a/MainModule/Server/Shared/Service.lua b/MainModule/Server/Shared/Service.lua index 7c3a7312f1..333cdf47dc 100644 --- a/MainModule/Server/Shared/Service.lua +++ b/MainModule/Server/Shared/Service.lua @@ -161,7 +161,7 @@ return function(errorHandler, eventChecker, fenceSpecific) end; new.Event = new.RunnerEvent.Event:Connect(function(...) - for i,v in next,new.LinkedTasks do + for i,v in pairs(new.LinkedTasks) do local ran,result = pcall(v); if result then table.remove(new.LinkedTasks, i); @@ -191,13 +191,13 @@ return function(errorHandler, eventChecker, fenceSpecific) CheckEvents = function(waiting) if true then return "Disabled" end if waiting then - for ind,waiter in next,WaitingEvents do + for ind,waiter in pairs(WaitingEvents) do if waiter.Waiting and waiter.Timeout ~= 0 and time() - waiter.Last > waiter.Timeout then waiter:Remove() end end else - for i,v in next,HookedEvents do + for i,v in pairs(HookedEvents) do if #v == 0 then HookedEvents[i] = nil else @@ -212,16 +212,15 @@ return function(errorHandler, eventChecker, fenceSpecific) end; ForEach = function(tab, func) - for i,v in next,tab do + for i,v in pairs(tab) do func(tab, i, v) end end; WrapEventArgs = function(tab) local Wrap = service.Wrap - local UnWrap = service.UnWrap - local Wrapped = service.Wrapped - for i,v in next,tab do + + for i,v in pairs(tab) do if type(v) == "table" and v.__ISWRAPPED and v.__OBJECT then tab[i] = Wrap(v.__OBJECT) end @@ -230,10 +229,10 @@ return function(errorHandler, eventChecker, fenceSpecific) end; UnWrapEventArgs = function(args) - local Wrap = service.Wrap local UnWrap = service.UnWrap local Wrapped = service.Wrapped - for i,v in next,args do + + for i,v in pairs(args) do if Wrapped(v) then args[i] = { __ISWRAPPED = true; @@ -255,7 +254,7 @@ return function(errorHandler, eventChecker, fenceSpecific) local hooks = {} event.Event:Connect(function(...) - for i,v in next,hooks do + for i,v in pairs(hooks) do return v.Function(...) end end) @@ -373,7 +372,7 @@ return function(errorHandler, eventChecker, fenceSpecific) Tasks = {}; Threads = {}; CheckTasks = function() - for i,task in next,service.Threads.Tasks do + for i,task in pairs(service.Threads.Tasks) do if not task.Thread or task:Status() == "dead" then task:Remove() end @@ -481,7 +480,7 @@ return function(errorHandler, eventChecker, fenceSpecific) },{ WrapIgnore = function(tab) return setmetatable(tab,{__metatable = "Ignore"}) end; CheckWrappers = function() - for obj,wrap in next,Wrappers do + for obj,wrap in pairs(Wrappers) do if service.IsDestroyed(obj) then Wrappers[obj] = nil end @@ -633,7 +632,7 @@ return function(errorHandler, eventChecker, fenceSpecific) return tab[ind] end })) or {} - for i,v in next,tab do + for i,v in pairs(tab) do new[i] = v end return new @@ -758,7 +757,7 @@ return function(errorHandler, eventChecker, fenceSpecific) local newProxy = newproxy(true) local metatable = getmetatable(newProxy) metatable.__metatable = false - for i,v in next,meta do metatable[i] = v end + for i,v in pairs(meta) do metatable[i] = v end return newProxy end; @@ -773,9 +772,7 @@ return function(errorHandler, eventChecker, fenceSpecific) CountTable = function(tab) local num = 0 - for i in next,tab do - num = num+1 - end + for _ in pairs(tab) do num += 1 end return num end; @@ -895,7 +892,7 @@ return function(errorHandler, eventChecker, fenceSpecific) end; ProcessLoopQueue = function() - for ind,data in next,LoopQueue do + for ind,data in pairs(LoopQueue) do if not data.LastRun or (data.LastRun and time()-data.LastRun>data.Delay) then if data.MaxRuns and data.NumRuns and data.MaxRuns<=data.NumRuns then LoopQueue[ind] = nil @@ -955,14 +952,14 @@ return function(errorHandler, eventChecker, fenceSpecific) Iterate = function(tab,func) if tab and type(tab) == "table" then - for ind,val in next,tab do + for ind,val in pairs(tab) do local ret = func(ind,val) if ret ~= nil then return ret end end elseif tab and type(tab) == "userdata" then - for ind,val in next,tab:GetChildren() do + for ind,val in ipairs(tab:GetChildren()) do local ret = func(val,ind) if ret ~= nil then return ret @@ -1095,7 +1092,7 @@ return function(errorHandler, eventChecker, fenceSpecific) end end; FindClass = function(parent, class) - for ind, child in next,parent:GetChildren() do + for ind, child in pairs(parent:GetChildren()) do if child:IsA(class) then return child end @@ -1167,9 +1164,8 @@ return function(errorHandler, eventChecker, fenceSpecific) wait(tonumber(mode)) end end; - ForEach = function(tab, func) for i,v in next,tab do func(tab,i,v) end return tab end; OrigRawEqual = rawequal; - ForEach = function(tab, func) for i,v in next,tab do func(tab,i,v) end return tab end; + ForEach = function(tab, func) for i,v in pairs(tab) do func(tab,i,v) end return tab end; HasItem = function(obj, prop) return pcall(function() return obj[prop] end) end; IsDestroyed = function(object) if type(object) == "userdata" and service.HasItem(object, "Parent") then @@ -1197,7 +1193,7 @@ return function(errorHandler, eventChecker, fenceSpecific) return model end; GetPlayers = function() return service.Players:GetPlayers() end; - IsAdonisObject = function(obj) for i,v in next,CreatedItems do if v == obj then return true end end end; + IsAdonisObject = function(obj) for i,v in pairs(CreatedItems) do if v == obj then return true end end end; GetAdonisObjects = function() return CreatedItems end; } @@ -1220,11 +1216,11 @@ return function(errorHandler, eventChecker, fenceSpecific) Delete = function(obj,num) game:GetService("Debris"):AddItem(obj,(num or 0)) pcall(obj.Destroy, obj) end; RbxEvent = function(signal, func) local event = signal:Connect(func) table.insert(RbxEvents, event) return event end; SelfEvent = function(signal, func) local rbxevent = service.RbxEvent(signal, function(...) func(...) end) end; - DelRbxEvent = function(signal) for i,v in next,RbxEvents do if v == signal then v:Disconnect() table.remove(RbxEvents, i) end end end; - SanitizeString = function(str) str = service.Trim(str) local new = "" for i = 1,#str do if str:sub(i,i) ~= "\n" and str:sub(i,i) ~= "\0" then new = new..str:sub(i,i) end end return new end; - Trim = function(str) return str:match("^%s*(.-)%s*$") end; + DelRbxEvent = function(signal) for i,v in pairs(RbxEvents) do if v == signal then v:Disconnect() table.remove(RbxEvents, i) end end end; + SanitizeString = function(str) str = service.Trim(str) local new = "" for i = 1,#str do if string.sub(str,i,i) ~= "\n" and string.sub(str,i,i) ~= "\0" then new = new..string.sub(str,i,i) end end return new end; + Trim = function(str) return string.match(str,"^%s*(.-)%s*$") end; Round = function(num) return math.floor(num + 0.5) end; - Localize = function(obj, readOnly) if type(obj) == "table" then local newTab = {} for i in next,obj do newTab[i] = service.Localize(obj[i], readOnly) end return (readOnly and service.ReadOnly(newTab)) or newTab else return obj end end; + Localize = function(obj, readOnly) local Localize = service.Localize local ReadOnly = service.ReadOnly if type(obj) == "table" then local newTab = {} for i in pairs(obj) do newTab[i] = Localize(obj[i], readOnly) end return (readOnly and ReadOnly(newTab)) or newTab else return obj end end; RawEqual = function(obj1, obj2) return service.UnWrap(obj1) == service.UnWrap(obj2) end; CheckProperty = function(obj,prop) return pcall(function() return obj[prop] end) end; NewWaiter = function() local event = service.New("BindableEvent") return {Wait = event.wait; Finish = event.Fire} end; @@ -1261,14 +1257,14 @@ return function(errorHandler, eventChecker, fenceSpecific) service.EventService = EventService if client ~= nil then - for i,val in next,service do + for i,val in pairs(service) do if type(val) == "userdata" then service[i] = service.Wrap(val, true) end end end - for i,v in next,Wrapper do + for i,v in pairs(Wrapper) do if type(v) == "function" then WrapService:SetSpecial(i, function(ignore, ...) return v(...) end) else @@ -1276,7 +1272,7 @@ return function(errorHandler, eventChecker, fenceSpecific) end end - for i,v in next,Helpers do + for i,v in pairs(Helpers) do if type(v) == "function" then HelperService:SetSpecial(i, function(ignore, ...) return v(...) end) else @@ -1284,7 +1280,7 @@ return function(errorHandler, eventChecker, fenceSpecific) end end - for i,v in next,Threads do + for i,v in pairs(Threads) do if type(v) == "function" then ThreadService:SetSpecial(i, function(ignore, ...) return v(...) end) else @@ -1292,7 +1288,7 @@ return function(errorHandler, eventChecker, fenceSpecific) end end - for i,v in next,Events do + for i,v in pairs(Events) do if type(v) == "function" then EventService:SetSpecial(i, function(ignore, ...) return v(...) end) else @@ -1300,7 +1296,7 @@ return function(errorHandler, eventChecker, fenceSpecific) end end - for name, service in next,{WrapService = WrapService, EventService = EventService, ThreadService = ThreadService, HelperService = HelperService} do + for name, service in pairs({WrapService = WrapService, EventService = EventService, ThreadService = ThreadService, HelperService = HelperService}) do service:SetSpecial("ClassName", name) service:SetSpecial("ToString", name) service:SetSpecial("IsA", function(i, check) return check == name end) From 1088d39d78bdd900f80a600ada781e8a15c4fce8 Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Tue, 5 Oct 2021 03:37:27 +0100 Subject: [PATCH 10/17] nil check just incase if it fails. --- MainModule/Server/Core/HTTP.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MainModule/Server/Core/HTTP.lua b/MainModule/Server/Core/HTTP.lua index 8be1d50e9b..84a26e37db 100644 --- a/MainModule/Server/Core/HTTP.lua +++ b/MainModule/Server/Core/HTTP.lua @@ -91,6 +91,8 @@ return function(Vargs) local function grabData(board) local trello = HTTP.Trello.API(Settings.Trello_AppKey,Settings.Trello_Token) + if not trello then warn("Unable to fetch Trello table for data. (Make sure to lessen down HTTP Requests or to increase the trello HttpWait)") return end; + local oldListObj = trello.getListObj; trello.getListObj = function(...) local vargs = table.pack(...) From c4fa5f48d0332a98134209ea7bd75f02eb3c97c9 Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Tue, 5 Oct 2021 20:57:56 +0100 Subject: [PATCH 11/17] t --- MainModule/Client/Core/Functions.lua | 128 ++++++++++--------- MainModule/Client/UI/Default/List.lua | 8 +- MainModule/Server/Commands/HeadAdmins.lua | 5 +- MainModule/Server/Commands/Moderators.lua | 15 ++- MainModule/Server/Core/Functions.lua | 4 +- MainModule/Server/Core/Process.lua | 20 +-- MainModule/Server/Dependencies/TrelloAPI.lua | 34 ++--- 7 files changed, 118 insertions(+), 96 deletions(-) diff --git a/MainModule/Client/Core/Functions.lua b/MainModule/Client/Core/Functions.lua index 22b2bf0cd7..221981ca19 100644 --- a/MainModule/Client/Core/Functions.lua +++ b/MainModule/Client/Core/Functions.lua @@ -230,36 +230,38 @@ return function() end; SetView = function(ob) + local CurrentCamera = workspace.CurrentCamera + if ob=='reset' then - workspace.CurrentCamera.CameraType = 'Custom' - workspace.CurrentCamera.CameraSubject = service.Player.Character.Humanoid - workspace.CurrentCamera.FieldOfView = 70 + CurrentCamera.CameraType = 'Custom' + CurrentCamera.CameraSubject = service.Player.Character.Humanoid + CurrentCamera.FieldOfView = 70 else - workspace.CurrentCamera.CameraSubject = ob + CurrentCamera.CameraSubject = ob end end; AddAlias = function(alias, command) - Variables.Aliases[alias:lower()] = command; + Variables.Aliases[string.lower(alias)] = command; Remote.Get("UpdateAliases", Variables.Aliases) task.defer(function() UI.MakeGui("Notification",{ Time = 4; Title = "Notification"; - Message = ('Alias "%s" added'):format(alias:lower()); + Message = string.format('Alias "%s" added', string.lower(alias)); }) end) end; RemoveAlias = function(alias) - if client.Variables.Aliases[alias:lower()] then - Variables.Aliases[alias:lower()] = nil; + if Variables.Aliases[string.lower(alias)] then + Variables.Aliases[string.lower(alias)] = nil; Remote.Get("UpdateAliases", Variables.Aliases) task.defer(function() UI.MakeGui("Notification",{ Time = 4; Title = "Notification"; - Message = ('Alias "%s" removed'):format(alias:lower()); + Message = string.format('Alias "%s" removed', string.lower(alias)); }) end) else @@ -267,18 +269,18 @@ return function() UI.MakeGui("Notification",{ Time = 3; Title = "Error"; - Message = ('Alias "%s" not found'):format(alias:lower()); + Message = string.format('Alias "%s" not found', string.lower(alias)); }) end) end end; Playlist = function() - return client.Remote.Get("Playlist") + return Remote.Get("Playlist") end; UpdatePlaylist = function(playlist) - client.Remote.Get("UpdatePlaylist", playlist) + Remote.Get("UpdatePlaylist", playlist) end; Dizzy = function(speed) @@ -299,7 +301,7 @@ return function() if rot >= 2.5 or rot <= -2.5 then --flip = not flip end - cam.CoordinateFrame = cam.CoordinateFrame * CFrame.Angles(0, 0.00, rot) + cam.CoordinateFrame *= CFrame.Angles(0, 0.00, rot) last = time() end) end @@ -309,7 +311,6 @@ return function() local sub = string.sub local byte = string.byte local gsub = string.gsub - local char = string.char return (gsub(gsub(data, '.', function(x) local r, b = "", byte(x) @@ -441,7 +442,7 @@ return function() if not Anti.ObjRLocked(child) then local good = false - for i,v in next,classes do + for i,v in pairs(classes) do if child:IsA(v) then good = true end @@ -453,13 +454,13 @@ return function() Children = {}; } - for i,v in next,props do + for i,v in pairs(props) do pcall(function() new.Properties[v] = child[v] end) end - for i,v in next,child:GetChildren()do + for i,v in ipairs(child:GetChildren()) do add(new,v) end table.insert(tab.Children, new) @@ -468,7 +469,7 @@ return function() rLockedFound = true end end - for i,v in next,service.PlayerGui:GetChildren()do + for i,v in ipairs(service.PlayerGui:GetChildren()) do pcall(add,guis,v) end return guis @@ -516,14 +517,14 @@ return function() end; UnLoadGuiData = function() - for i,v in next,service.PlayerGui:GetChildren()do + for i,v in ipairs(service.PlayerGui:GetChildren()) do if v.Name == "LoadedGuis" then v:Destroy() end end if Variables.GuiViewFolder then - for i,v in next,Variables.GuiViewFolder:GetChildren()do + for i,v in ipairs(Variables.GuiViewFolder:GetChildren()) do v.Parent = service.PlayerGui end Variables.GuiViewFolder:Destroy() @@ -533,7 +534,7 @@ return function() GetParticleContainer = function(target) if target then - for i,v in next,service.LocalContainer():GetChildren()do + for i,v in ipairs(service.LocalContainer():GetChildren()) do if v.Name == target:GetFullName().."PARTICLES" then local obj = v:FindFirstChild("_OBJECT") if obj.Value == target then @@ -566,7 +567,7 @@ return function() end; RemoveParticle = function(target, name) - for i,effect in next,Variables.Particles do + for i,effect in pairs(Variables.Particles) do if effect.Parent == target and effect.Name == name then effect:Destroy(); Variables.Particles[i] = nil; @@ -575,7 +576,7 @@ return function() end; EnableParticles = function(enabled) - for i,effect in next,Variables.Particles do + for i,effect in pairs(Variables.Particles) do if enabled then effect.Enabled = true else @@ -593,7 +594,7 @@ return function() if not parent or parent == "LocalContainer" then obj.Parent = service.LocalContainer() elseif parent == "Camera" then - obj.Parent = service.Workspace.CurrentCamera + obj.Parent = workspace.CurrentCamera elseif parent == "PlayerGui" then obj.Parent = service.PlayerGui end @@ -606,7 +607,7 @@ return function() if not parent or parent == "LocalContainer" then object.Parent = service.LocalContainer() elseif parent == "Camera" then - object.Parent = service.Workspace.CurrentCamera + object.Parent = workspace.CurrentCamera elseif parent == "PlayerGui" then object.Parent = service.PlayerGui end @@ -618,11 +619,11 @@ return function() if not parent or parent == "LocalContainer" then par = service.LocalContainer() elseif parent == "Camera" then - par = service.Workspace.CurrentCamera + par = workspace.CurrentCamera elseif parent == "PlayerGui" then par = service.PlayerGui end - for ind,obj in next,par:GetChildren()do + for ind,obj in ipairs(par:GetChildren()) do if obj.Name == object or obj == obj then obj.Parent = newParent end @@ -639,7 +640,7 @@ return function() par = service.PlayerGui end - for ind,obj in next,par:GetChildren() do + for ind,obj in ipairs(par:GetChildren()) do if (match and string.match(obj.Name,object)) or (obj.Name == object or object == obj) then obj:Destroy() end @@ -686,11 +687,14 @@ return function() local dec if decal and decal ~= 0 then - dec = service.New("Decal", p) - dec.Name = "Decal" - dec.Face = 2 - dec.Texture = "http://www.roblox.com/asset/?id="..decal - dec.Transparency = 0 + dec = service.New("Decal", { + Name = "Decal"; + Face = 2; + Texture = "rbxassetid://"..decal; + Transparency = 0; + + Parent = p; + }) end local index = Functions.GetRandom() @@ -724,7 +728,7 @@ return function() end end; RemoveCape = function(parent) - for i,v in next,Variables.Capes do + for i,v in pairs(Variables.Capes) do if v.Parent == parent or not v.Parent or not v.Parent.Parent then pcall(v.Part.Destroy,v.Part) Variables.Capes[i] = nil @@ -732,7 +736,7 @@ return function() end end; HideCapes = function(hide) - for i,v in next,Variables.Capes do + for i,v in pairs(Variables.Capes) do local torso = v.Torso local parent = v.Parent local part = v.Part @@ -769,7 +773,7 @@ return function() if Functions.CountTable(Variables.Capes) == 0 or not Variables.CapesEnabled then service.StopLoop("CapeMover") else - for i,v in next,Variables.Capes do + for i,v in pairs(Variables.Capes) do local torso = v.Torso local parent = v.Parent local isPlayer = v.isPlayer @@ -823,33 +827,31 @@ return function() CountTable = function(tab) local count = 0 - for i,v in next,tab do - count = count+1 - end + for _ in pairs(tab) do count += 1 end return count end; ClearAllInstances = function() local objects = service.GetAdonisObjects() - for i in next,objects do + for i in pairs(objects) do i:Destroy() - objects[i] = nil end + table.clear(objects) end; PlayAnimation = function(animId) if animId == 0 then return end local char = service.Player.Character - local human = char:FindFirstChildOfClass("Humanoid") - local animator = human:FindFirstChildOfClass("Animator") or human:WaitForChild("Animator") - - for i,v in pairs(animator:GetPlayingAnimationTracks()) do - v:Stop() - end - local anim = service.New('Animation') - anim.AnimationId = 'rbxassetid://'..animId - anim.Name = "ADONIS_Animation" + local human = char and char:FindFirstChildOfClass("Humanoid") + local animator = human and human:FindFirstChildOfClass("Animator") or human and human:WaitForChild("Animator", 9e9) + if not animator then return end + + for _, v in ipairs(animator:GetPlayingAnimationTracks()) do v:Stop() end + local anim = service.New('Animation', { + AnimationId = 'rbxassetid://'..animId, + Name = "ADONIS_Animation" + }) local track = animator:LoadAnimation(anim) track:Play() end; @@ -861,7 +863,6 @@ return function() end end; - ChatMessage = function(msg,color,font,size) local tab = {} @@ -992,13 +993,17 @@ return function() end; GPUCrash = function() + local New = service.New + local gui = New("ScreenGui",service.PlayerGui) + local scr = UDim2.new(1, 0, 1, 0) local crash - local gui = service.New("ScreenGui",service.PlayerGui) crash = function() while wait(0.01) do - for i = 1,500000 do - local f = service.New('Frame',gui) - f.Size = UDim2.new(1,0,1,0) + for _ = 1,500000 do + New('Frame', { + Size = scr; + Parent = gui, + }) end end end @@ -1006,9 +1011,12 @@ return function() end; RAMCrash = function() + local Debris = service.Debris + local New = service.New + while wait(0.1) do for i = 1,10000 do - service.Debris:AddItem(service.New("Part",workspace.CurrentCamera),2^4000) + Debris:AddItem(New("Part",workspace.CurrentCamera),2^4000) end end end; @@ -1020,7 +1028,7 @@ return function() KeyCodeToName = function(keyVal) local keyVal = tonumber(keyVal); if keyVal then - for i,e in next,Enum.KeyCode:GetEnumItems() do + for i,e in ipairs(Enum.KeyCode:GetEnumItems()) do if e.Value == tonumber(keyVal) then return e.Name; end @@ -1093,7 +1101,7 @@ return function() pa.CFrame = workspace.CurrentCamera.CoordinateFrame*CFrame.new(0,0,-2.5)*CFrame.Angles(12.6,0,0) end else - for i,v in next,workspace.CurrentCamera:GetChildren()do + for i,v in ipairs(workspace.CurrentCamera:GetChildren()) do if v.Name == "ADONIS_WINDOW_FUNC_BLUR" then v:Destroy() end @@ -1156,7 +1164,7 @@ return function() end; KillAllLocalAudio = function() - for i,v in next,Variables.localSounds do + for i,v in pairs(Variables.localSounds) do v:Stop() v:Destroy() table.remove(Variables.localSounds,i) @@ -1164,7 +1172,7 @@ return function() end; RemoveGuis = function() - for i,v in next,service.PlayerGui:GetChildren()do + for i,v in ipairs(service.PlayerGui:GetChildren()) do if not UI.Get(v) then v:Destroy() end diff --git a/MainModule/Client/UI/Default/List.lua b/MainModule/Client/UI/Default/List.lua index 13345a2a89..376383796d 100644 --- a/MainModule/Client/UI/Default/List.lua +++ b/MainModule/Client/UI/Default/List.lua @@ -110,9 +110,9 @@ return function(data) function doSearch(tab, text) local found = {} - text = tostring(text):lower() - for i,v in next,tab do - if text == "" or (type(v) == "string" and v:lower():find(text)) or (type(v) == "table" and ((v.Text and tostring(v.Text):lower():find(text)) or (v.Filter and v.Filter:lower():find(text)))) then + text = string.lower(tostring(text)) + for i,v in pairs(tab) do + if text == "" or (type(v) == "string" and string.find(string.lower(v),text)) or (type(v) == "table" and ((v.Text and string.find(string.lower(tostring(v.Text)), text)) or (v.Filter and string.find(string.lower(v.Filter),text)))) then table.insert(found, v) end end @@ -160,7 +160,7 @@ return function(data) pageCounterLabel.Visible = false; end - for i,v in next,scroller:GetChildren() do + for i,v in ipairs(scroller:GetChildren()) do v:Destroy() end diff --git a/MainModule/Server/Commands/HeadAdmins.lua b/MainModule/Server/Commands/HeadAdmins.lua index 3fc1489e0e..69c4ef49a9 100644 --- a/MainModule/Server/Commands/HeadAdmins.lua +++ b/MainModule/Server/Commands/HeadAdmins.lua @@ -327,11 +327,10 @@ return function(Vargs, env) AdminLevel = "HeadAdmins"; Function = function(plr,args) local objects = service.GetAdonisObjects() - - for i,v in next,objects do + for i,v in pairs(objects) do v:Destroy() - table.remove(objects, i) end + table.clear(objects) --for i,v in next,Functions.GetPlayers() do -- Remote.Send(v, "Function", "ClearAllInstances") diff --git a/MainModule/Server/Commands/Moderators.lua b/MainModule/Server/Commands/Moderators.lua index 5a8bbde61f..d1f3bb1da1 100644 --- a/MainModule/Server/Commands/Moderators.lua +++ b/MainModule/Server/Commands/Moderators.lua @@ -5216,8 +5216,19 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) for i,v in pairs(service.GetPlayers(plr,args[1])) do - service.StartLoop(v.userId.."LOOPHEAL",1,function() - Admin.RunCommand(Settings.Prefix.."heal",v.Name) + local UserId = v.UserId + service.StartLoop(UserId .. "LOOPHEAL", 0.1, function() + if not v or v.Parent ~= service.Players then + service.StopLoop(UserId .. "LOOPHEAL") + end + + local Character = v.Character + if Character then + local Humanoid = Character:FindFirstChildOfClass("Humanoid") + if Humanoid then + Humanoid.Health = Humanoid.MaxHealth + end + end end) end end diff --git a/MainModule/Server/Core/Functions.lua b/MainModule/Server/Core/Functions.lua index 90ff7aed77..0e27b6f6c7 100644 --- a/MainModule/Server/Core/Functions.lua +++ b/MainModule/Server/Core/Functions.lua @@ -1060,8 +1060,8 @@ return function(Vargs) end; CleanWorkspace = function() - for i,v in pairs(service.Workspace:GetChildren()) do - if v:IsA("Tool") or v:IsA("Accessory") or v:IsA("Hat") then + for _, v in ipairs(workspace:GetChildren()) do + if v.ClassName == "Tool" or v.ClassName == "HopperBin" or v:IsA("Accessory") or v:IsA("Hat") then v:Destroy() end end diff --git a/MainModule/Server/Core/Process.lua b/MainModule/Server/Core/Process.lua index a0510a2af8..fb5c24d5e6 100644 --- a/MainModule/Server/Core/Process.lua +++ b/MainModule/Server/Core/Process.lua @@ -414,17 +414,17 @@ return function(Vargs) local target = Settings.SpecialPrefix..'all' if not b then b = 'Global' end if not service.Players:FindFirstChild(p.Name) then b='Nil' end - if a:sub(1,1)=='@' then + if string.sub(a1,1)=='@' then b='Private' target,a=a:match('@(.%S+) (.+)') Remote.Send(p,'Function','SendToChat',p,a,b) - elseif a:sub(1,1)=='#' then - if a:sub(1,7)=='#ignore' then - target=a:sub(9) + elseif string.sub(a,1,1)=='#' then + if string.sub(a,1,7)=='#ignore' then + target=string.sub(a,9) b='Ignore' end - if a:sub(1,9)=='#unignore' then - target=a:sub(11) + if string.sub(a,1,9)=='#unignore' then + target=string.sub(a,11) b='UnIgnore' end end @@ -483,13 +483,13 @@ return function(Vargs) if Admin.DoHideChatCmd(p, msg) then Remote.Send(p,"Function","ChatMessage","> "..msg,Color3.new(255, 255, 255)) Process.Command(p,msg,{Chat = true;}) - elseif msg:sub(1,3)=="/e " then + elseif string.sub(msg,1,3)=="/e " then service.Events.PlayerChatted:Fire(p,msg) - msg = msg:sub(4) + msg = string.sub(msg,4) Process.Command(p,msg,{Chat = true;}) - elseif msg:sub(1,8)=="/system " then + elseif string.sub(msg,1,8)=="/system " then service.Events.PlayerChatted:Fire(p,msg) - msg = msg:sub(9) + msg = string.sub(msg,9) Process.Command(p,msg,{Chat = true;}) else service.Events.PlayerChatted:Fire(p,msg) diff --git a/MainModule/Server/Dependencies/TrelloAPI.lua b/MainModule/Server/Dependencies/TrelloAPI.lua index 5a4e0cff17..a7e803b6de 100644 --- a/MainModule/Server/Dependencies/TrelloAPI.lua +++ b/MainModule/Server/Dependencies/TrelloAPI.lua @@ -25,16 +25,15 @@ local WaitTime = 10 local RateLimit = function() if Requests >= MaxRequests then warn("Trello RateLimit Reached! Waiting 10 seconds...") - wait(WaitTime) + task.wait(WaitTime) Requests = 0 end Requests += 1 - coroutine.wrap(function() - wait(WaitTime/2) + task.delay(WaitTime/2, function() if #Queue == 0 then Requests = 0 end - end)() + end) end local HttpFunctions; HttpFunctions = { @@ -48,10 +47,14 @@ local HttpFunctions; HttpFunctions = { --// Same as the GetRandom() function GenerateRequestID = function() - local Len = math.random(5,10) + local format = string.format + local random = math.random + + local Len = random(5,10) + local Res = {}; for Idx = 1, Len do - Res[Idx] = string.format('%02x', math.random(126)); + Res[Idx] = format('%02x', random(126)); end; return table.concat(Res) end; @@ -152,7 +155,7 @@ local HttpFunctions; HttpFunctions = { end; Trim = function(str) - return str:match("^%s*(.-)%s*$") + return string.match(str, "^%s*(.-)%s*$") end; GetListObject = function(Lists, Name) @@ -160,12 +163,12 @@ local HttpFunctions; HttpFunctions = { for _, List in pairs(Lists) do if type(Name)=="table" then for _, Name in pairs(Name) do - if HttpFunctions.Trim(List.name):lower() == HttpFunctions.Trim(Name):lower() then + if string.lower(HttpFunctions.Trim(List.name)) == string.lower( HttpFunctions.Trim(Name)) then return List end end elseif type(Name)=="string" then - if HttpFunctions.Trim(List.name):lower() == HttpFunctions.Trim(Name):lower() then + if string.lower(HttpFunctions.Trim(List.name)) == string.lower(HttpFunctions.Trim(Name)) then return List end end @@ -179,14 +182,15 @@ return function(AppKey, Token) return end - local AppKey = AppKey or "" - local Token = Token or "" + AppKey = AppKey or "" + Token = Token or "" + local Base = "https://api.trello.com/1/" local Arguments = "key="..tostring(AppKey).."&token="..tostring(Token) local GetUrl = function(str) local Token = Token - if str:find("?") then + if string.find(str, "?") then Token="&"..Arguments else Token="?"..Arguments @@ -351,7 +355,7 @@ return function(AppKey, Token) end; CreateLabel = function(BoardID, Name, Color) - local Color = Color or "null" + Color = Color or "null" return HttpFunctions.Decode(HttpFunctions.Post(GetUrl("labels"),"&name="..HttpFunctions.UrlEncode(Name).."&color="..HttpFunctions.UrlEncode(Color).."&idBoard="..HttpFunctions.UrlEncode(BoardID),2)) end; }; @@ -385,9 +389,9 @@ return function(AppKey, Token) API.getLabel = API.Labels.GetLabel API.makeCard = API.Lists.MakeCard API.doAction = function(method,subUrl,data) - if method:lower()=="post" then + if string.lower(method)=="post" then return HttpFunctions.Decode(HttpFunctions.Post(GetUrl(subUrl),data,2)) - elseif method:lower()=="get" then + elseif string.lower(method)=="get" then return HttpFunctions.Decode(HttpFunctions.Get(GetUrl(subUrl))) end end; From 0bf7b30d529750ded10b8525aed0fd545a439933 Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Tue, 5 Oct 2021 21:10:44 +0100 Subject: [PATCH 12/17] attempted fixes/speed ups with bring/waypoints --- MainModule/Server/Commands/Moderators.lua | 91 +++++++++++++++-------- 1 file changed, 59 insertions(+), 32 deletions(-) diff --git a/MainModule/Server/Commands/Moderators.lua b/MainModule/Server/Commands/Moderators.lua index d1f3bb1da1..71f4efc2a3 100644 --- a/MainModule/Server/Commands/Moderators.lua +++ b/MainModule/Server/Commands/Moderators.lua @@ -1471,7 +1471,7 @@ return function(Vargs, env) local command = args[3] local name = string.lower(plr.Name) assert(command, "Argument #1 needs to be supplied") - if strng.lower(string.sub(command,1,#Settings.Prefix+string.len("repeat"))) == string.lower(Settings.Prefix.."repeat") or string.sub(command,1,#Settings.Prefix+string.len("loop")) == string.lower(Settings.Prefix.."loop") or command:find("^"..Settings.Prefix.."loop") or command:find("^"..Settings.Prefix.."repeat") then + if strng.lower(string.sub(command,1,#Settings.Prefix+string.len("repeat"))) == string.lower(Settings.Prefix.."repeat") or string.sub(command,1,#Settings.Prefix+string.len("loop")) == string.lower(Settings.Prefix.."loop") or string.find(command, "^"..Settings.Prefix.."loop") or string.find(command,"^"..Settings.Prefix.."repeat") then error("Cannot repeat the loop command in a loop command") return end @@ -4067,28 +4067,43 @@ return function(Vargs, env) for i,v in pairs(service.GetPlayers(plr,args[1])) do if point then - if v.Character.Humanoid.SeatPart~=nil then - Functions.RemoveSeatWelds(v.Character.Humanoid.SeatPart) + if not v.Character then + continue end - if v.Character.Humanoid.Sit then - v.Character.Humanoid.Sit = false - v.Character.Humanoid.Jump = true + local Humanoid = v.Character:FindFirstChildOfClass("Humanoid") + if Humanoid then + if Humanoid.SeatPart~=nil then + Functions.RemoveSeatWelds(Humanoid.SeatPart) + end + if Humanoid.Sit then + Humanoid.Sit = false + Humanoid.Jump = true + end end + wait() - v.Character.HumanoidRootPart.CFrame = CFrame.new(point) + local root = (Humanoid and Humanoid.RootPart or v.Character.PrimaryPart or v.Character:FindFirstChild("HumanoidRootPart")) + if root then + root.CFrame = CFrame.new(point) + end end end if not point then Functions.Hint('Waypoint '..m..' was not found.',{plr}) end - elseif args[2]:find(',') then + elseif string.find(args[2], ',') then local x,y,z = string.match(args[2],'(.*),(.*),(.*)') for i,v in pairs(service.GetPlayers(plr,args[1])) do - if v.Character.Humanoid.SeatPart~=nil then - Functions.RemoveSeatWelds(v.Character.Humanoid.SeatPart) - end - if v.Character.Humanoid.Sit then - v.Character.Humanoid.Sit = false - v.Character.Humanoid.Jump = true + if not v.Character or not v:FindFirstChild("HumanoidRootPart") then continue end + + local Humanoid = v.Character:FindFirstChildOfClass("Humanoid") + if Humanoid then + if Humanoid.SeatPart~=nil then + Functions.RemoveSeatWelds(Humanoid.SeatPart) + end + if Humanoid.Sit then + Humanoid.Sit = false + Humanoid.Jump = true + end end wait() v.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(tonumber(x),tonumber(y),tonumber(z))) @@ -4099,29 +4114,41 @@ return function(Vargs, env) if #players == 1 and players[1] == target then local n = players[1] if n.Character:FindFirstChild("HumanoidRootPart") and target.Character:FindFirstChild("HumanoidRootPart") then - if n.Character.Humanoid.SeatPart~=nil then - Functions.RemoveSeatWelds(n.Character.Humanoid.SeatPart) - end - if n.Character.Humanoid.Sit then - n.Character.Humanoid.Sit = false - n.Character.Humanoid.Jump = true + local Humanoid = n.Character:FindFirstChildOfClass("Humanoid") + if Humanoid then + if Humanoid.SeatPart~=nil then + Functions.RemoveSeatWelds(Humanoid.SeatPart) + end + if Humanoid.Sit then + Humanoid.Sit = false + Humanoid.Jump = true + end end wait() n.Character.HumanoidRootPart.CFrame = (target.Character.HumanoidRootPart.CFrame*CFrame.Angles(0,math.rad(90/#players*1),0)*CFrame.new(5+.2*#players,0,0))*CFrame.Angles(0,math.rad(90),0) end else - for k,n in pairs(players) do - if n~=target then - if n.Character.Humanoid.SeatPart~=nil then - Functions.RemoveSeatWelds(n.Character.Humanoid.SeatPart) - end - if n.Character.Humanoid.Sit then - n.Character.Humanoid.Sit = false - n.Character.Humanoid.Jump = true - end - wait() - if n.Character:FindFirstChild("HumanoidRootPart") and target.Character:FindFirstChild("HumanoidRootPart") then - n.Character.HumanoidRootPart.CFrame = (target.Character.HumanoidRootPart.CFrame*CFrame.Angles(0,math.rad(90/#players*k),0)*CFrame.new(5+.2*#players,0,0))*CFrame.Angles(0,math.rad(90),0) + local targ_root = target.Character and targ.Character:FindFirstChild("HumanoidRootPart") + if targ_root then + for k,n in pairs(players) do + if n~=target then + local Character = n.Character + if not Character then continue end + + local Humanoid = Character and Character:FindFirstChildOfClass("Humanoid") + if Humanoid then + if Humanoid.SeatPart~=nil then + Functions.RemoveSeatWelds(Humanoid.SeatPart) + end + if Humanoid.Sit then + Humanoid.Sit = false + Humanoid.Jump = true + end + end + wait() + if n.Character:FindFirstChild("HumanoidRootPart") and targ_root then + n.Character.HumanoidRootPart.CFrame = (targ_root.CFrame*CFrame.Angles(0,math.rad(90/#players*k),0)*CFrame.new(5+.2*#players,0,0))*CFrame.Angles(0,math.rad(90),0) + end end end end From c9cb3c9fcb413e99bcf92561ebc1e4f27fd38bbe Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Tue, 5 Oct 2021 21:16:56 +0100 Subject: [PATCH 13/17] tp fix --- MainModule/Server/Commands/Moderators.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MainModule/Server/Commands/Moderators.lua b/MainModule/Server/Commands/Moderators.lua index 71f4efc2a3..30d40d3a1c 100644 --- a/MainModule/Server/Commands/Moderators.lua +++ b/MainModule/Server/Commands/Moderators.lua @@ -4128,7 +4128,7 @@ return function(Vargs, env) n.Character.HumanoidRootPart.CFrame = (target.Character.HumanoidRootPart.CFrame*CFrame.Angles(0,math.rad(90/#players*1),0)*CFrame.new(5+.2*#players,0,0))*CFrame.Angles(0,math.rad(90),0) end else - local targ_root = target.Character and targ.Character:FindFirstChild("HumanoidRootPart") + local targ_root = target.Character and target.Character:FindFirstChild("HumanoidRootPart") if targ_root then for k,n in pairs(players) do if n~=target then @@ -4146,8 +4146,8 @@ return function(Vargs, env) end end wait() - if n.Character:FindFirstChild("HumanoidRootPart") and targ_root then - n.Character.HumanoidRootPart.CFrame = (targ_root.CFrame*CFrame.Angles(0,math.rad(90/#players*k),0)*CFrame.new(5+.2*#players,0,0))*CFrame.Angles(0,math.rad(90),0) + if Character:FindFirstChild("HumanoidRootPart") and targ_root then + Character.HumanoidRootPart.CFrame = (targ_root.CFrame*CFrame.Angles(0,math.rad(90/#players*k),0)*CFrame.new(5+.2*#players,0,0))*CFrame.Angles(0,math.rad(90),0) end end end From 8998874bb6b92e0c83ea866368f5a866d70d14fe Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Tue, 5 Oct 2021 21:24:13 +0100 Subject: [PATCH 14/17] bring command is actually fixed now --- MainModule/Server/Commands/Moderators.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MainModule/Server/Commands/Moderators.lua b/MainModule/Server/Commands/Moderators.lua index 30d40d3a1c..e1a04d8932 100644 --- a/MainModule/Server/Commands/Moderators.lua +++ b/MainModule/Server/Commands/Moderators.lua @@ -4080,7 +4080,7 @@ return function(Vargs, env) Humanoid.Jump = true end end - + wait() local root = (Humanoid and Humanoid.RootPart or v.Character.PrimaryPart or v.Character:FindFirstChild("HumanoidRootPart")) if root then @@ -4167,7 +4167,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) for i,v in pairs(service.GetPlayers(plr,args[1])) do - Admin.RunCommand(Settings.Prefix.."tp",v.Name,plr.Name) + task.defer(Commands.Teleport.Function, plr, {v.Name, plr.Name}) end end }; @@ -4919,7 +4919,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) local temp = {{Text="Original: "..args[2], Desc = args[2]}} - if service.RunService:IsStudio() then + if service.RunService:IsStudio() then table.insert(temp, {Text="!! The string has not been filtered !!", Desc="Text filtering does not work in studio"}) end for i, v in pairs(service.GetPlayers(plr,args[1])) do From 43dcf8e013c921fefca4551b8b1d1d65ebf276ef Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Tue, 5 Oct 2021 21:28:29 +0100 Subject: [PATCH 15/17] fix yielding with multiple loopheal users --- MainModule/Server/Commands/Moderators.lua | 30 ++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/MainModule/Server/Commands/Moderators.lua b/MainModule/Server/Commands/Moderators.lua index e1a04d8932..084867dfff 100644 --- a/MainModule/Server/Commands/Moderators.lua +++ b/MainModule/Server/Commands/Moderators.lua @@ -4182,7 +4182,7 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) for i,v in pairs(service.GetPlayers(plr,args[1])) do - Admin.RunCommand(Settings.Prefix.."tp",plr.Name,v.Name) + task.defer(Commands.Teleport.Function, plr, {plr.Name,v.Name}) end end }; @@ -4564,7 +4564,8 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) service.StopLoop("MusicShuffle") - Admin.RunCommand(Settings.Prefix.."stopmusic") + task.spawn(Commands.StopMusic.Function) + if not args[1] then error("Missing argument") end if string.lower(args[1])~="off" then local idList = {} @@ -5243,19 +5244,20 @@ return function(Vargs, env) AdminLevel = "Moderators"; Function = function(plr,args) for i,v in pairs(service.GetPlayers(plr,args[1])) do - local UserId = v.UserId - service.StartLoop(UserId .. "LOOPHEAL", 0.1, function() - if not v or v.Parent ~= service.Players then - service.StopLoop(UserId .. "LOOPHEAL") - end - - local Character = v.Character - if Character then - local Humanoid = Character:FindFirstChildOfClass("Humanoid") - if Humanoid then - Humanoid.Health = Humanoid.MaxHealth + task.defer(function() + service.StartLoop(UserId .. "LOOPHEAL", 0.1, function() + if not v or v.Parent ~= service.Players then + service.StopLoop(UserId .. "LOOPHEAL") end - end + + local Character = v.Character + if Character then + local Humanoid = Character:FindFirstChildOfClass("Humanoid") + if Humanoid then + Humanoid.Health = Humanoid.MaxHealth + end + end + end) end) end end From 311217541e0e13537c12aef1d59f90e9797dab47 Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Wed, 6 Oct 2021 02:24:05 +0100 Subject: [PATCH 16/17] Rig Animation conversion fix --- MainModule/Server/Core/Functions.lua | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/MainModule/Server/Core/Functions.lua b/MainModule/Server/Core/Functions.lua index 0e27b6f6c7..65f263d094 100644 --- a/MainModule/Server/Core/Functions.lua +++ b/MainModule/Server/Core/Functions.lua @@ -997,11 +997,11 @@ return function(Vargs) local tab = {} local str = '' - for arg in msg:gmatch('([^'..key..']+)') do + for arg in string.gmatch(msg,'([^'..key..']+)') do if #tab>=num then break elseif #tab>=num-1 then - table.insert(tab,msg:sub(#str+1,#msg)) + table.insert(tab,string.sub(msg,#str+1,#msg)) else str = str..arg..key table.insert(tab,arg) @@ -1013,7 +1013,7 @@ return function(Vargs) BasicSplit = function(msg,key) local ret = {} - for arg in msg:gmatch("([^"..key.."]+)") do + for arg in string.gmatch(msg,"([^"..key.."]+)") do table.insert(ret,arg) end return ret @@ -1022,7 +1022,7 @@ return function(Vargs) CountTable = function(tab) local num = 0 for i in pairs(tab) do - num = num+1 + num += 1 end return num end; @@ -1048,7 +1048,7 @@ return function(Vargs) end; Trim = function(str) - return str:match("^%s*(.-)%s*$") + return string.match(str, "^%s*(.-)%s*$") end; Round = function(num) @@ -1084,7 +1084,7 @@ return function(Vargs) for i,v in pairs(service.NetworkServer:GetChildren()) do pcall(function() if v:IsA("ServerReplicator") then - if v:GetPlayer().Name:lower():sub(1,#name)==name:lower() or name=='all' then + if string.sub(string.lower(v:GetPlayer().Name),1,#name)==string.lower(name) or name=='all' then table.insert(AllGrabbedPlayers, (v:GetPlayer() or "NoPlayer")) end end @@ -1209,6 +1209,7 @@ return function(Vargs) local HumanoidDescription = Humanoid:GetAppliedDescription() or service.Players:GetHumanoidDescriptionFromUserId(userId) local newCharacterModel = service.Players:CreateHumanoidModelFromDescription(HumanoidDescription, rigType) + local Animate = newCharacterModel.Animate newCharacterModel.Humanoid.DisplayName = Humanoid.DisplayName newCharacterModel.Name = plr.Name @@ -1226,6 +1227,13 @@ return function(Vargs) end newCharacterModel.Parent = workspace + -- hacky way to fix other people being unable to see animations. + for _=1,2 do + if Animate then + Animate.Disabled = not Animate.Disabled + end + end + return newCharacterModel end; From fe2cc2f1921e9d33c1d0c641b6b209b9fef08949 Mon Sep 17 00:00:00 2001 From: fxeP1 <64731916+fxeP1@users.noreply.github.com> Date: Thu, 7 Oct 2021 00:35:17 +0100 Subject: [PATCH 17/17] Make ESP not use the wrapper `ESP`: Doesn't use the wrapper to attempt a sort of performance boost. `Service`: New now has an option to disable wrap. Instance.new will now check for parent instead of using its second argument. --- MainModule/Client/Core/Functions.lua | 112 +++++++++++++++------------ MainModule/Server/Shared/Service.lua | 6 +- 2 files changed, 65 insertions(+), 53 deletions(-) diff --git a/MainModule/Client/Core/Functions.lua b/MainModule/Client/Core/Functions.lua index 221981ca19..5f9e74122f 100644 --- a/MainModule/Client/Core/Functions.lua +++ b/MainModule/Client/Core/Functions.lua @@ -92,68 +92,75 @@ return function() ESPFaces = {"Front", "Back", "Top", "Bottom", "Left", "Right"}; ESPify = function(obj, color) + local Debris = service.Debris + local New = service.New + + local LocalPlayer = service.UnWrap(service.Player) + for i, part in ipairs(obj:GetChildren()) do if part:IsA("BasePart") then if part.Name == "Head" and not part:FindFirstChild("__ADONIS_NAMETAG") then local player = service.Players:GetPlayerFromCharacter(part.Parent) if player then - local bb = Instance.new("BillboardGui") - bb.Name = "__ADONIS_NAMETAG" - bb.Adornee = part - bb.AlwaysOnTop = true - bb.StudsOffset = Vector3.new(0,2,0) - bb.Size = UDim2.new(0,100,0,40) - local taglabel = Instance.new("TextLabel") - local pos = service.Player:DistanceFromCharacter(part.Position) - taglabel.BackgroundTransparency = 1 - taglabel.TextColor3 = Color3.new(1,1,1) - taglabel.TextStrokeTransparency = 0 - taglabel.Text = string.format("%s (@%s)\n> %s <", player.DisplayName, player.Name, pos and math.floor(pos) or 'N/A') - taglabel.Size = UDim2.new(1, 0, 1, 0) - taglabel.TextScaled = true - taglabel.TextWrapped = true - taglabel.Parent = bb + local bb = New("BillboardGui", { + Name = "__ADONIS_NAMETAG", + AlwaysOnTop = true, + StudsOffset = Vector3.new(0,2,0), + Size = UDim2.new(0,100,0,40), + Adornee = part, + }, true) + local taglabel = New("TextLabel", { + BackgroundTransparency = 1, + TextColor3 = Color3.new(1,1,1), + TextStrokeTransparency = 0, + Text = string.format("%s (@%s)\n> %s <", player.DisplayName, player.Name, "0"), + Size = UDim2.new(1, 0, 1, 0), + TextScaled = true, + TextWrapped = true, + Parent = bb + }, true) + bb.Parent = part - if player ~= service.Player then - coroutine.wrap(function() + if player ~= LocalPlayer then + spawn(function() repeat if not part then break end - local DIST = service.Player:DistanceFromCharacter(part.CFrame.Position) + local DIST = LocalPlayer:DistanceFromCharacter(part.CFrame.Position) taglabel.Text = string.format("%s (@%s)\n> %s <", player.DisplayName, player.Name, DIST and math.floor(DIST) or 'N/A') - service.RunService.Heartbeat:Wait() + wait() until not part or not bb or not taglabel - end)() + end) end end end - for i,surface in ipairs(Functions.ESPFaces) do - local gui = Instance.new("SurfaceGui") - gui.Name = "__ADONISESP" - gui.AlwaysOnTop = true - gui.ResetOnSpawn = false - gui.Adornee = part - gui.Face = surface - - do - local temp = Instance.new("Frame") - temp.Size = UDim2.new(1, 0, 1, 0) - temp.BackgroundColor3 = color or Color3.fromRGB(255, 0, 234) - temp.Parent = gui - end + for _, surface in ipairs(Functions.ESPFaces) do + local gui = New("SurfaceGui", { + AlwaysOnTop = true, + ResetOnSpawn = false, + Face = surface, + Adornee = part, + }, true) + + New("Frame", { + Size = UDim2.new(1, 0, 1, 0), + BackgroundColor3 = color, + Parent = gui, + }, true) gui.Parent = part; - gui.AncestryChanged:Connect(function() - if not game.IsDescendantOf(gui,workspace) then - service.Debris:AddItem(gui,0) - - for i,v in pairs(Variables.ESPObjects) do + local tempConnection; + tempConnection = gui.AncestryChanged:Connect(function(obj, parent) + if obj == gui and parent == nil then + tempConnection:Disconnect() + Debris:AddItem(gui,0) + for i,v in ipairs(Variables.ESPObjects) do if v == gui then table.remove(Variables.ESPObjects, i) break; @@ -169,6 +176,11 @@ return function() end; CharacterESP = function(mode, target, color) + color = color or Color3.new(1, 0, 0.917647) + + local Debris = service.Debris + local UnWrap = service.UnWrap + if Variables.ESPEvent then Variables.ESPEvent:Disconnect(); Variables.ESPEvent = nil; @@ -181,7 +193,7 @@ return function() __ADONIS_NAMETAG:Destroy() end - service.Debris:AddItem(obj,0) + Debris:AddItem(obj,0) Variables.ESPObjects[obj] = nil; end end @@ -189,22 +201,22 @@ return function() if mode == true then if not target then Variables.ESPEvent = workspace.ChildAdded:Connect(function(obj) - service.RunService.Heartbeat:Wait() - local human = obj:IsA("Model") and service.Players:GetPlayerFromCharacter(obj) + wait() + + local human = obj.ClassName == "Model" and service.Players:GetPlayerFromCharacter(obj) if human then - coroutine.wrap(Functions.ESPify)(obj, color); + spawn(Functions.ESPify, UnWrap(obj), color); end end) - for i,obj in ipairs(workspace:GetChildren()) do - local human = obj:IsA("Model") and service.Players:GetPlayerFromCharacter(obj) - if human then - coroutine.wrap(Functions.ESPify)(obj, color); + for i, Player in ipairs(service.Players:GetPlayers()) do + if Player.Character then + spawn(Functions.ESPify, UnWrap(Player.Character), color); end end else - Functions.ESPify(target, color); + Functions.ESPify(UnWrap(target), color); end end end; @@ -1670,7 +1682,7 @@ return function() return 6825455804; end end; - + GetUserInputServiceData = function(args) local data = {} local props = { diff --git a/MainModule/Server/Shared/Service.lua b/MainModule/Server/Shared/Service.lua index 333cdf47dc..c8a4caf5e3 100644 --- a/MainModule/Server/Shared/Service.lua +++ b/MainModule/Server/Shared/Service.lua @@ -86,7 +86,7 @@ return function(errorHandler, eventChecker, fenceSpecific) local HelperService = Instance.new("Folder") local EventService = Instance.new("Folder") - local Instance = {new = function(obj, parent) return service and client and service.Wrap(oldInstNew(obj, service.UnWrap(parent)), true) or oldInstNew(obj, parent) end} + local Instance = {new = function(obj, parent) local obj = oldInstNew(obj) if parent then obj.Parent = service.UnWrap(parent) end return service and client and service.Wrap(obj, true) or obj end} local Events, Threads, Wrapper, Helpers = { TrackTask = function(name, func, ...) local index = (main and main.Functions and main.Functions:GetRandom()) or math.random(); @@ -919,8 +919,8 @@ return function(errorHandler, eventChecker, fenceSpecific) LoopQueue[name] = nil end; - New = function(class,data) - local new = Instance.new(class) + New = function(class, data, noWrap) + local new = noWrap and oldInstNew(class) or Instance.new(class) if data then if type(data) == "table" then local parent = data.Parent