-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSR_Loader
More file actions
429 lines (329 loc) · 12.8 KB
/
SR_Loader
File metadata and controls
429 lines (329 loc) · 12.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
if game:GetService("RunService"):IsStudio() then
warn("Some features of the admin panel will be unavailable in Roblox studio due to the way certain things are ran within Roblox Studio, and is therefore recommended that you conduct most of your testing within the actual game in order to fully test the capabilities of this admin system / panel.")
end
local SSS = game:GetService("ServerScriptService")
local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TextChatService")
local config = require(script.Config)
--cooldowns
local cmdcooldown = config["Cooldowns"]["CommandCooldown"]
local servmsgcooldown = config["Cooldowns"]["ServerMsgCooldown"]
local reportcooldown = config["Cooldowns"]["ReportCooldown"]
-- stafflock
local stafflock = script.StaffLock
--banlist
local banlist = config["Banned Users"]
--Datastore stuff
local DDS = game:GetService("DataStoreService")
local dsName = config["Datastore"]["Name"]
local bandatastore = DDS:GetDataStore(game.PlaceId..dsName,"Banned_Users")
local vipbandatastore = nil
-- chat version
local chatversion
--checks if chat version is set to legacychatservice
if TS.ChatVersion == Enum.ChatVersion.TextChatService then
chatversion = "new"
elseif TS.ChatVersion == Enum.ChatVersion.LegacyChatService then
chatversion = "legacy"
end
--framework parent and values
local framework = script["SR_FrameWork"]
framework.Parent = script.Parent
framework.Disabled = false
local PKU = framework:FindFirstChild("PermKickedUsers")
local UIBlur = framework:FindFirstChild("UIs"):FindFirstChild("UIBlur")
UIBlur.Parent = game.Lighting
-- anti exploit
local AntiExploit = config["Anti-Cheat"]
local AntiExploitEnabled = AntiExploit["AntiCheatEnabled"]
local AEMs = framework.AntiExploitModules
--Trello Stuff
local Trello = config["Trello Stuff"]
local TrelloEnabled = Trello["TrelloEnabled"]
local TrelloToken = Trello["TrelloToken"]
local TrelloBoardName = Trello["TrelloBoardName"]
local TrelloBanListName = Trello["BanListName"]
local TrelloAPIKey = Trello["TrelloAPIKey"]
local TrelloRanks = Trello["Ranks"]
local APIs = framework["API's"]
local nonRequireTrelloAPI = APIs.TrelloAPI
local TrelloAPISettings = nonRequireTrelloAPI.Settings
TrelloAPISettings:WaitForChild("TrelloToken").Value = TrelloToken
TrelloAPISettings:WaitForChild("TrelloKey").Value = TrelloAPIKey
local TrelloApi = require(APIs.TrelloAPI)
-- overhead tag
local overheadTagAPI = require(APIs.OverheadTagAPI)
-- change rank api
local rankAPI = require(APIs.RankAPI)
-- player service
local players = game:GetService("Players")
-- tracking
local trackingFolder = framework.Tracking
local trackingEvent = game.ReplicatedStorage.SRAdminEvents.TrackEvent
-- server type
local serverType = "REG"
if game.PrivateServerId ~= "" then
serverType = "VIP"
vipbandatastore = DDS:GetDataStore(game.PrivateServerId,"Banned_Users")
end
players.PlayerAdded:Connect(function(player)
local framework2 = script.Parent:WaitForChild("SR_FrameWork")
local API = framework2["API's"]
local HelpReqUI = framework2["UIs"]["HelpRequests"]:Clone()
HelpReqUI.Parent = player.PlayerGui
local userTrackFolder = Instance.new("Folder")
userTrackFolder.Name = player.Name
userTrackFolder.Parent = trackingFolder
if stafflock.Value == true then
player:Kick("Server is currently locked. Please wait until it is unlocked.")
end
if PKU:FindFirstChild(player.Name) then
player:Kick("You have been permanently kicked from this server. Please try joining another server.")
return
end
if table.find(banlist,player.UserId) or table.find(banlist,player.Name) then
player:Kick("You have been banned from the experience")
return
elseif TrelloEnabled == true then
local BanBoardID = TrelloApi.BoardsAPI.GetBoardID(TrelloBoardName)
local BanListID = TrelloApi.BoardsAPI.GetListID(TrelloBanListName,BanBoardID)
local BanCards = TrelloApi.CardsAPI.GetCardsOnList(BanListID)
for _, i in pairs(BanCards) do
if string.find(i.name,player.UserId) or string.find(i.name,player.Name) then
player:Kick("You have been banned from this experience")
end
end
else
local baninfo = nil
local banstoreData,err = pcall(function()
baninfo = bandatastore:GetAsync(player.UserId)
end)
if baninfo ~= nil and type(baninfo) == "table" then
if baninfo[4] == true then
if baninfo[3] == true then
player:Kick("You have been banned from this experience | Length: Infinite | Time Remaining: Infinite | Reason: "..tostring(baninfo[1]))
return
else
local banDate = string.split(baninfo[5],"/")
local roundedDuration = tonumber(baninfo[2])
local banDateTFormat = os.time({year = tonumber(banDate[3]),month = tonumber(banDate[1]), day = tonumber(banDate[2]) })
local tempCurrDate = string.split(os.date("%x"),"/")
local currDate = string.split(tempCurrDate[1].."/"..tempCurrDate[2].."/"..tostring(os.date("*t").year),"/")
local currDateTFormat = os.time({year = tonumber(currDate[3]),month = tonumber(currDate[1]), day = tonumber(currDate[2]) })
local diff = currDateTFormat - banDateTFormat
local days = math.floor(diff / 86400)
if days < roundedDuration then
player:Kick("You have been banned from this experience | Length: "..baninfo[2].." day(s) | Time Remaining: "..roundedDuration-days.." day(s) | Reason: "..tostring(baninfo[1]))
return
else
local succ,err = pcall(function()
bandatastore:SetAsync(player.UserId,{nil,nil,false,false,nil}) -- {reason, timeleft, is permanment, is bannable, time when banned}
end)
if err then
print("SR Admin System encountered the following error while attempting to remove a ban: "..tostring(err))
end
end
end
end
else
local succ,err = pcall(function()
bandatastore:SetAsync(player.UserId,{nil,nil,false,false,nil})
end)
if err then
print("SR Admin System encountered the following error while attempting to set a default value: "..tostring(err))
end
end
if serverType == "VIP" then
local vipbaninfo = nil
local vipbanstoreData,err = pcall(function()
vipbaninfo = vipbandatastore:GetAsync(player.UserId)
end)
if vipbaninfo ~= nil and type(vipbaninfo) == "table" then
if vipbaninfo[4] == true then
if vipbaninfo[3] == true then
player:Kick("You have been banned from this private server | Length: Infinite | Time Remaining: Infinite | Reason: "..tostring(baninfo[1]))
return
else
local vipbanDate = string.split(vipbaninfo[5],"/")
local viproundedDuration = tonumber(vipbaninfo[2])
local vipbanDateTFormat = os.time({year = tonumber(vipbanDate[3]),month = tonumber(vipbanDate[1]), day = tonumber(vipbanDate[2]) })
local tempCurrDate = string.split(os.date("%x"),"/")
local currDate = string.split(tempCurrDate[1].."/"..tempCurrDate[2].."/"..tostring(os.date("*t").year),"/")
local currDateTFormat = os.time({year = tonumber(currDate[3]),month = tonumber(currDate[1]), day = tonumber(currDate[2]) })
local diff = currDateTFormat - vipbanDateTFormat
local days = math.floor(diff / 86400)
if days < viproundedDuration then
player:Kick("You have been banned from this private server | Length: "..vipbaninfo[2].." day(s) | Time Remaining: "..viproundedDuration-days.." days | Reason: "..tostring(vipbaninfo[1]))
return
else
local succ,err = pcall(function()
vipbandatastore:SetAsync(player.UserId,{nil,nil,false,false,nil}) -- {reason, timeleft, is permanment, is bannable, time when banned}
end)
if err then
print("SR Admin System encountered the following error while attempting to remove a ban: "..tostring(err))
end
end
end
end
else
local succ,err = pcall(function()
vipbandatastore:SetAsync(player.UserId,{nil,nil,false,false,nil})
end)
if err then
print("SR Admin System encountered the following error while attempting to set a default value: "..tostring(err))
end
end
end
end
local plrchar = player.Character or player.CharacterAdded:Wait()
local plrrank = plrchar:WaitForChild("Rank")
local servplrrank = Instance.new("IntValue")
servplrrank.Parent = script.Parent:WaitForChild("SR_FrameWork").PlayerRanks
servplrrank.Name = player.Name
local apt = script["Admin Panel"]
framework.UIs.Panel.UIManager.RprtInterval.Value = reportcooldown
framework.UIs.Panel.UIManager.CMDCooldown.Value = cmdcooldown
local setUserRank = rankAPI.LoadRank(player)[3]
if setUserRank == nil then
warn("Failed to load the rank for the user: "..player.Name.." ("..player.UserId..")")
end
local char = player.Character or player.CharacterAdded:Wait()
overheadTagAPI.SetTag(player)
if AntiExploitEnabled then
local c = char:GetChildren()
local x = 0
local r6 = {
"Head",
"Torso",
"HumanoidRootPart",
"Left Arm",
"Right Arm",
"Left Leg",
"Right Leg",
}
local r15 = {
"Head",
"LowerTorso",
"UpperTorso",
"HumanoidRootPart",
"LeftLowerArm",
"LeftUpperArm",
"LeftHand",
"RightLowerArm",
"RightUpperArm",
"RightHand",
"LeftLowerLeg",
"LeftUpperLeg",
"LeftFoot",
"RightLowerLeg",
"RightUpperLeg",
"RightFoot",
}
for i=1,#c do
if c[i]:IsA("BasePart") then
local reg = false
if table.find(r6,c[i].Name) and reg == false then
x+=1
reg = true
elseif table.find(r15,c[i].Name) and reg == false then
x +=1
reg = true
end
end
end
if x == #r6 then
AEMs.CkVal:Clone().Parent = char[r6[math.random(1,#r6)]]
elseif x == #r15 then
AEMs.CkVal:Clone().Parent = char[r15[math.random(1,#r15)]]
end
end
if servplrrank.Value > 0 then
apt:Clone().Parent = player.Backpack
end
if chatversion == "legacy" then
local chattagAPI = require(API.LegacyChatTagAPI)
local ChatService = require(SSS:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
--sets chat tag
ChatService.SpeakerAdded:Connect(function(speakerName)
chattagAPI.SetTag(speakerName)
end)
end
end)
-- tool stuff and other miscellaneous stuff
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if char:WaitForChild("HumanoidRootPart"):FindFirstChild("Original") == nil then
local newAttach = Instance.new("Attachment")
newAttach.Name = "Original"
newAttach.Parent = char:WaitForChild("HumanoidRootPart")
end
local allTrackedUsers = trackingFolder:GetDescendants()
for _,k in pairs(allTrackedUsers) do
if k:IsA("ObjectValue") and k.Name == plr.Name then
if game.Players:FindFirstChild(k.Name) then
repeat wait() until plr.Character ~= nil
local tempHRP = plr.Character:WaitForChild("HumanoidRootPart")
k.Value = tempHRP
trackingEvent:FireClient(game.Players:FindFirstChild(k.Name),"track",tempHRP)
end
elseif k:IsA("ObjectValue") and k.Parent.Name == plr.Name then
if game.Players:FindFirstChild(k.Name) then
repeat wait() until game.Players:FindFirstChild(k.Name).Character ~= nil
local tempHRP = game.Players:FindFirstChild(k.Name).Character:WaitForChild("HumanoidRootPart")
k.Value = tempHRP
trackingEvent:FireClient(plr,"track",tempHRP)
end
end
end
overheadTagAPI.SetTag(plr)
local humanoid = char:WaitForChild("Humanoid")
humanoid.Died:Connect(function()
local v = plr.Backpack:FindFirstChild("Admin Panel")
if v then
v:Destroy()
end
plr.CharacterAdded:Wait()
local servplrrank = script.Parent:WaitForChild("SR_FrameWork").PlayerRanks:FindFirstChild(plr.Name)
if servplrrank then
if servplrrank.Value > 0 then
script["Admin Panel"]:Clone().Parent = plr.Backpack
end
end
end)
end)
end)
local ChatLogs = {}
local MsgNumber = 0
local ChatlogAPI = require(script.Parent:WaitForChild("SR_FrameWork")["API's"]["ChatLogsAPI"])
game.Players.PlayerAdded:Connect(function(player)
-- chat logs stuff
player.Chatted:Connect(function(msg)
if msg then
local filteredmsg, errors = pcall(function()
local filteredmsgResult = TS:FilterStringAsync(msg,player.UserId)
local filteredmsg = filteredmsgResult:GetNonChatStringForBroadcastAsync()
msg = filteredmsg
end)
local currTime = tostring((DateTime.now()):FormatLocalTime("LLL","en-us")).." EST/EDT"
table.insert(ChatLogs,{player,player.UserId,msg,currTime,MsgNumber})
ChatlogAPI.SentMessage(ChatLogs)
MsgNumber += 1
end
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
if player.Character ~= nil then
if player.Character:FindFirstChild("HumanoidRootPart") ~= nil then
trackingEvent:FireAllClients("untrack",player.Character:FindFirstChild("HumanoidRootPart"))
end
if trackingFolder:FindFirstChild(player.Name) then
trackingFolder:FindFirstChild(player.Name):Destroy()
end
local allTrackedPlrs = trackingFolder:GetDescendants()
for _,i in pairs(allTrackedPlrs) do
if i.Name == player.Name then
i:Destroy()
end
end
end
end)