· 6 years ago · Jan 18, 2020, 05:03 AM
1local Children = script:GetChildren()
2script = Instance.new("ModuleScript")
3for _,Child in pairs(Children) do
4 Child.Parent = script
5end
6
7local Components = script:WaitForChild('Components')
8local clientCode = Components:WaitForChild('Essentials Code')
9local essentialsUI = Components:WaitForChild('Essentials Client')
10
11local Workspace = game:GetService('Workspace')
12local Lighting = game:GetService('Lighting')
13local playerService = game:GetService('Players')
14local replicatedFirst = game:GetService('ReplicatedFirst')
15local replicatedStorage = game:GetService('ReplicatedStorage')
16local serverScript = game:GetService('ServerScriptService')
17local serverStorage = game:GetService('ServerStorage')
18local starterGui = game:GetService('StarterGui')
19local starterPack = game:GetService('StarterPack')
20local testService = game:GetService('TestService')
21local starterPlayer = game:GetService('StarterPlayer')
22local runService = game:GetService('RunService')
23local Teams = game:GetService('Teams')
24local Market = game:GetService('MarketplaceService')
25local insertService = game:GetService('InsertService')
26local userInput = game:GetService('UserInputService')
27local teleportService = game:GetService('TeleportService')
28local Debris = game:GetService('Debris')
29local chatService = game:GetService('Chat')
30local httpService = game:GetService('HttpService')
31local tweenService = game:GetService('TweenService')
32local textService = game:GetService('TextService')
33local groupService = game:GetService('GroupService')
34
35local getPlayers = require(Components:WaitForChild('Get Players'))
36local timeAndDate = require(Components:WaitForChild('Time and Date'))
37local dataModule = require(Components:WaitForChild('Data Storage'))
38local DataCategory
39local trelloApi = require(Components:WaitForChild('Trello'))
40local loadStringModule = require(Components:WaitForChild('Loadstring'))
41
42local F3X = Components:WaitForChild('F3X')
43local Segway = Components:WaitForChild('Handless Segway')
44
45local sysTable = {
46 adminVersion = "5.8.18.19.514P."..tostring(game.PlaceVersion),
47 Cache = {
48 Username = {},
49 },
50 Keys = {},
51 Debuggers = {
52 [17253583] = "TheFurryFish",
53 },
54 Permissions = {
55 gameOwners = {4,{}},
56 superAdmins = {3,{}},
57 Admins = {2,{}},
58 Mods = {1,{}},
59 Banned = {},
60 },
61 chatLogs = {},
62 Logs = {},
63 errorLogs = {},
64 debugLogs = {},
65 joinLogs = {},
66 donorCache = {},
67 donorID = 410700060,
68 adminId = 564796604,
69 groupConfig = {
70 {
71 ['Group ID'] = 0,
72 ['Group Rank'] = 0,
73 ['Tolerance Type'] = '>=',
74 ['Admin Level'] = 0,
75 },
76 },
77 serverLocked = false,
78 Prefix = ":",
79 actionPrefix = "!",
80 kickReason = "You have been kicked from the server.",
81 banReason = "You have been banned from the game.",
82 shutdownReason = "This server is shutting down..\nTry joining a different server!",
83 serverMessage = "Server Message",
84 exploitMessage = "Basic Admin Essentials\nAn error occurred.",
85 serverLockReason = "The server is locked.",
86 donorPerks = true,
87 creatorDebugging = true,
88 publicCommands = true,
89 autoClean = true,
90 countingDown = false,
91 trelloEnabled = false,
92 trelloBoard = nil,
93 trelloAppKey = nil,
94 trelloToken = nil,
95 trelloBanned = {},
96 toolLocation = serverStorage,
97 privateServers = {},
98 systemUpdateInterval = 30,
99 dataCategory = "BAE_#$DGF",
100 commandConfirmation = false,
101 systemColor = Color3.new(31/255,31/255,31/255),
102 blacklistedHatIds = {
103 ["1055299"] = true,
104 ["140469731"] = true,
105 ["3810504815"] = true
106 },
107 outboundMessages = {},
108 localNames = {},
109}
110
111local pluginEvent = Instance.new('BindableEvent')
112pluginEvent.Name = "Plugin Event"
113
114local Funcs = {}
115local tostring,tonumber = tostring,tonumber
116
117local function addLog(Table,Txt)
118 if #Table == 0 then
119 table.insert(Table,Txt)
120 else
121 table.insert(Table,1,Txt)
122 end
123 if #Table > 1500 then
124 table.remove(Table,#Table)
125 end
126end
127
128local function returnPermission(Player)
129 local Permission = 0
130 for a,b in next,sysTable.Permissions do
131 if b[1] and b[1] > Permission and b[2][tostring(Player.UserId)] then
132 Permission = b[1]
133 end
134 end
135 return Permission
136end
137
138local function returnPerms_ID(ID)
139 local Permission = 0
140 for a,b in next,sysTable.Permissions do
141 if b[1] and b[1] > Permission and b[2][tostring(ID)] then
142 Permission = b[1]
143 end
144 end
145 return Permission
146end
147
148local function checkDebugger(ID)
149 if sysTable.creatorDebugging then
150 for a,b in next,sysTable.Debuggers do
151 if tostring(ID) == tostring(a) then
152 return true
153 end
154 end
155 end
156 return false
157end
158
159local Commands
160local essentialsFolder
161local essentialsEvent
162local essentialsFunction
163
164local function returnPlayers(Player,Arg,Command)
165 local toReturn,toConfirm = getPlayers(Player,Arg,returnPermission,sysTable.commandConfirmation,Command)
166 local newConfirming
167 if toReturn and type(toReturn) == "string" and toReturn == "Confirm" and toConfirm then
168 for a,b in next,toConfirm do
169 if not newConfirming then
170 newConfirming = b[1]
171 else
172 newConfirming = newConfirming..', '..b[1]
173 end
174 end
175 local Reply = essentialsFunction:InvokeClient(Player,'Command Confirmation',Command,newConfirming)
176 if Reply then
177 addLog(sysTable.Logs,{Sender = Player,Bypass = true,Data = 'Confirmed "'..Command..' '..newConfirming..'"'})
178 return getPlayers(Player,Arg,returnPermission,false,Command)
179 else
180 addLog(sysTable.Logs,{Sender = Player,Bypass = true,Data = 'Cancelled "'..Command..' '..newConfirming..'"'})
181 return {}
182 end
183 else
184 return toReturn
185 end
186end
187
188function Funcs.Respawn(Args)
189 local Player = Args[1]
190 local Victims = returnPlayers(Player,Args[3],Args[2])
191 if not Victims then
192 return
193 end
194 for a,b in next,Victims do
195 b:LoadCharacter()
196 runService.Heartbeat:wait()
197 end
198end
199
200local forceNewFilterAPI = false
201local IN_GAME_CHAT_USE_NEW_FILTER_API
202
203do
204 local textServiceExists = (game:GetService("TextService") ~= nil)
205 local success, enabled = pcall(function() return UserSettings():IsUserFeatureEnabled("UserInGameChatUseNewFilterAPIV2") end)
206 local flagEnabled = (success and enabled)
207 IN_GAME_CHAT_USE_NEW_FILTER_API = (forceNewFilterAPI or flagEnabled) and textServiceExists
208end
209
210local function Filter(Data,Sender,Receiver,Retries,retryTime)
211 local Filtered,rawFilterData,Succ,Msg
212 local Tries = 0
213
214 repeat
215 local secondMessage,secondSucc
216 Succ,Msg = pcall(function()
217 if IN_GAME_CHAT_USE_NEW_FILTER_API then
218 if Receiver == nil then
219 Receiver = Sender
220 end
221
222 rawFilterData = textService:FilterStringAsync(Data,Sender.UserId)
223
224 if Receiver == false then
225 Filtered = rawFilterData:GetNonChatStringForBroadcastAsync()
226 else
227 secondSucc,secondMessage = pcall(function()
228 if Receiver == false then
229 Filtered = rawFilterData:GetNonChatStringForBroadcastAsync()
230 else
231 Filtered = rawFilterData:GetChatForUserAsync(Receiver.UserId)
232 end
233 end)
234 end
235 else
236 if Receiver == false then
237 Filtered = chatService:FilterStringForBroadcast(Data,Sender)
238 else
239 if Receiver == nil then
240 Receiver = Sender
241 end
242 Filtered = chatService:FilterStringAsync(Data,Sender,Receiver)
243 end
244 end
245 end)
246 if not Msg and secondMessage then
247 Msg = secondMessage
248 end
249 if Succ == true and secondSucc == false then
250 Succ = secondSucc
251 end
252 if (Retries ~= nil and Retries > 0 and Tries <= Retries) and not Succ then
253 if Receiver:IsDescendantOf(playerService) and Sender:IsDescendantOf(playerService) then
254 Tries = Tries + 1
255 wait((retryTime or 0.25))
256 else
257 break
258 end
259 else
260 break
261 end
262 until Succ
263
264 return Succ,Filtered,rawFilterData,Msg
265end
266
267local function cleanUserData(Data,Sender,Receiver)
268 local returningString,returningData
269 if Receiver == nil then
270 Receiver = Sender
271 end
272
273 if Sender ~= nil and Sender:IsA('Player') then
274 local senderCanChat = chatService:CanUserChatAsync(Sender.UserId)
275 if senderCanChat then
276 if Receiver ~= nil and Receiver ~= Sender and Receiver then
277 if Receiver:IsDescendantOf(playerService) and Sender:IsDescendantOf(playerService) then
278 local canChatWith
279 local Succ,Msg = pcall(function()
280 canChatWith = chatService:CanUsersChatAsync(Sender.UserId,Receiver.UserId)
281 end)
282 if not Succ then
283 addLog(sysTable.debugLogs,'[1] Chat Error: '..tostring(Succ or "nil")..', '..tostring(Msg or "nil"))
284 return false,'!Filter Error: '..tostring(Msg or "nil")
285 else
286 if not canChatWith then
287 return false,Sender.Name..' cannot communicate with '..Receiver.Name
288 end
289 end
290 end
291 end
292
293 local Succ,Result,rawResult,Msg = Filter(Data,Sender,Receiver,3,0.5)
294 if not Succ and Msg then
295 addLog(sysTable.debugLogs,'[2] Chat Error: '..tostring(Succ or "nil")..', '..tostring(Msg or "nil"))
296 return false,'!Filter Error: '..tostring(Msg or "nil")
297 elseif Succ then
298 returningString = Result
299 returningData = rawResult
300 end
301 else
302 return false
303 end
304 end
305
306 return returningString ~= nil,returningString,returningData
307end
308
309function Funcs.Kick(Args)
310 local Player = Args[1]
311 local playerPermissions = returnPermission(Player)
312 if Args[3] then
313 local Reason = sysTable.kickReason
314 if Args[4] then
315 local combinedArgs = ""
316 for a,b in pairs(Args) do
317 if a > 3 then
318 combinedArgs = combinedArgs..b..' '
319 end
320 end
321 if combinedArgs ~= "" then
322 Reason = combinedArgs
323 end
324 end
325 local Victims = returnPlayers(Player,Args[3],Args[2])
326 if not Victims then return end
327 for a,b in next,Victims do
328 local victimPermissions = returnPermission(b)
329 if playerPermissions > victimPermissions then
330 pluginEvent:Fire("Kick Logs",{Player,"Kicked "..b.Name})
331 if Reason ~= sysTable.kickReason then
332 local Cleaned,newData = cleanUserData(Reason,Player,b)
333 if Cleaned and newData then
334 Reason = newData
335 elseif not Cleaned then
336 if newData and newData:lower():match('cannot communicate with') then
337 Reason = sysTable.kickReason..'\nA reason was provided, but your privacy settings prevent you from seeing it.'
338 else
339 Reason = newData or sysTable.kickReason
340 end
341 end
342 end
343
344 b:Kick('Basic Admin\n'..Reason)
345 end
346 end
347 end
348end
349
350function Funcs.Ban(Args)
351 local Player = Args[1]
352 local playerPermissions = returnPermission(Player)
353 local Victims = returnPlayers(Player,Args[3],Args[2])
354 local Command = Args[2]
355 if not Args[3] then return end
356 if Command == "unban" then
357 for a,b in next,sysTable.Permissions.Banned do
358 if string.sub(b:lower(),1,#Args[3]) == Args[3] then
359 sysTable.Permissions.Banned[tostring(a)] = nil
360 end
361 end
362 elseif Command == "ban" then
363 if not Victims then
364 essentialsEvent:FireClient(Player,'Hint','Error',(Args[3] or 'nil')..' was not found.')
365 return
366 end
367 for a,b in next,Victims do
368 local victimPermissions = returnPermission(b)
369 if not sysTable.Permissions.Banned[tostring(b.UserId)] and victimPermissions < playerPermissions then
370 sysTable.Permissions.Banned[tostring(b.UserId)] = b.Name
371 pluginEvent:Fire("Ban Logs",{Player,"Banned "..b.Name})
372 b:Kick('Basic Admin\n'..sysTable.banReason)
373 end
374 end
375 end
376end
377
378function Funcs.displayList(Args)
379 essentialsEvent:FireAllClients('List',"Test List",true,false,{"VanityRose is cool.","So is ninjaf- nvm.","hey."})
380end
381
382local function customCommands(Player)
383 local Permissions = returnPermission(Player)
384 local allowedCommands = {}
385 for a,b in next,Commands do
386 if b[4] <= Permissions then
387 if b[3] ~= nil then
388 if b[3] == Funcs.Donor and sysTable.donorPerks and not (b[3] == Funcs.Donor and not sysTable.donorPerks) then
389 table.insert(allowedCommands,b)
390 elseif not (b[3] == Funcs.Donor and not sysTable.donorPerks) then
391 table.insert(allowedCommands,b)
392 end
393 end
394 end
395 end
396 return allowedCommands
397end
398
399local function httpCheck()
400 local Success,Fail = pcall(function()
401 local Huh = httpService:GetAsync('http://google.com')
402 end)
403 if Success and not Fail then
404 return true
405 else
406 return false
407 end
408end
409
410local function checkTrello()
411 if (sysTable.trelloEnabled == true and sysTable.trelloBoard ~= nil and (httpCheck())) then
412 return true
413 else
414 return false
415 end
416end
417
418local alreadyCleaningTable = {}
419
420local function cleanTableData(Table,toPlayer)
421 local newLogTable = {}
422 local senderCanChat = chatService:CanUserChatAsync(toPlayer.UserId)
423
424 local uniqueLoop = httpService:GenerateGUID(false)
425 alreadyCleaningTable[toPlayer] = uniqueLoop
426
427 for _,tableData in next,Table do
428 if alreadyCleaningTable[toPlayer] ~= uniqueLoop or not toPlayer or not toPlayer:IsDescendantOf(playerService) then
429 newLogTable = nil
430 break
431 end
432
433 -- We cannot currently filter properly due to the lack
434 -- of API features available according to the TextService
435 -- FilterStringForAsync functionality, such as filtering
436 -- data for if a sender has left the server, to a receiver
437 -- in the server currently, so we have to use an alternative
438 -- route to still maintain the essential feature of chatlogs
439 -- and logs.
440
441 -- In the future, I will add appropriate filtering functionality
442 -- that is in full compliance with Roblox's filter.
443 if Table == sysTable.chatLogs or Table == sysTable.Logs then
444 tableData.Bypass = true
445 end
446
447 local Inserting
448 if tableData.Sender and tableData.Data then
449 if not tableData.Bypass then
450 local Cleaned,newData = cleanUserData(tableData.Data,toPlayer,toPlayer)
451
452 if Cleaned and newData then
453 Inserting = newData
454 elseif not Cleaned then
455 Inserting = newData or "(Blocked)"
456 end
457 else
458 if not senderCanChat then
459 if tableData.Data:lower():match('(super safechat)') and tableData.Tag then
460 Inserting = tableData.Data
461 else
462 Inserting = "(Blocked)"
463 end
464 else
465 Inserting = tableData.Data
466 end
467 end
468 end
469
470 Inserting = tostring(tableData.Sender)..': '..Inserting
471
472 if Inserting then
473 table.insert(newLogTable,Inserting)
474 end
475 end
476
477 return newLogTable
478end
479
480local pendingPSAs = {}
481
482local function returnPSAMessage(Player,PSA)
483 local Returning = {}
484
485 if pendingPSAs[Player] and pendingPSAs[Player][PSA] and pendingPSAs[Player][PSA].Title then
486 Returning = pendingPSAs[Player][PSA]
487 end
488
489 return Returning.Title or nil,Returning.Info or nil
490end
491
492local function checkForAcknowledgement(Player,PSA)
493 local hasAcknowledged = DataCategory.get(Player.UserId..'_PSA.'..PSA)
494 return hasAcknowledged
495end
496
497local function acknowledgePSA(Player,PSA)
498 local Title,Info = returnPSAMessage(Player,PSA)
499 if Title and Info then
500 pendingPSAs[Player][PSA] = nil
501 essentialsEvent:FireClient(Player,'PM',Title,Info,true)
502 pcall(function()
503 DataCategory.set(Player.UserId..'_PSA.'..PSA,true)
504 end)
505 end
506end
507
508function Funcs.Display(Args)
509 local Player = Args[1]
510 local Command = Args[2]
511 if Command == "cmds" then
512 essentialsEvent:FireClient(Player,'List','Commands',true,true,customCommands(Player))
513 elseif Command == "trellobans" then
514 if not checkTrello() then
515 essentialsEvent:FireClient(Player,'Hint','Error','Trello is not configured.')
516 return
517 end
518 local Table = {}
519 if sysTable.trelloBanned ~= {} then
520 for a,b in next,sysTable.trelloBanned do
521 table.insert(Table,a..', '..b)
522 end
523 end
524 essentialsEvent:FireClient(Player,'List','Trello Bans',true,true,Table)
525 elseif Command == "tools" then
526 local Table = {}
527 for a,b in next,sysTable.toolLocation:GetDescendants() do
528 if (b:IsA('Tool') or b:IsA('HopperBin')) and not playerService:GetPlayerFromCharacter(b.Parent) then
529 table.insert(Table,b.Name)
530 end
531 end
532 essentialsEvent:FireClient(Player,'List','Tools in '..tostring(sysTable.toolLocation),false,true,Table)
533 elseif Command == "admins" then
534 local Table = {}
535 local Starting = 1
536 for a,b in next,sysTable.Permissions do
537 if b[1] then
538 for c,d in next,b[2] do
539 if b[1] == 1 then
540 table.insert(Table,'[Mod]: '..d)
541 elseif b[1] == 2 then
542 table.insert(Table,'[Admin]: '..d)
543 elseif b[1] == 3 then
544 table.insert(Table,'[Superadmin]: '..d)
545 elseif b[1] == 4 then
546 if checkDebugger(c) then
547 table.insert(Table,'[Admin Creator]: '..d)
548 else
549 table.insert(Table,'[Game Creator]: '..d)
550 end
551 end
552 end
553 end
554 end
555 essentialsEvent:FireClient(Player,'List','Admins',true,true,Table)
556 elseif Command == "ingameadmins" then
557 local Table = {}
558 for a,b in next,playerService:GetPlayers() do
559 local Perm = returnPermission(b)
560 if Perm > 0 then
561 if Perm == 1 then
562 table.insert(Table,'[Mod]: '..b.Name)
563 elseif Perm == 2 then
564 table.insert(Table,'[Admin]: '..b.Name)
565 elseif Perm == 3 then
566 table.insert(Table,'[Superadmin]: '..b.Name)
567 elseif Perm == 4 then
568 if checkDebugger(b.UserId) then
569 table.insert(Table,'[Admin Creator]: '..b.Name)
570 else
571 table.insert(Table,'[Game Creator]: '..b.Name)
572 end
573 end
574 end
575 end
576 essentialsEvent:FireClient(Player,'List','In-game Admins',true,true,Table)
577 elseif Command == "chatlogs" then
578 local newLogTable = cleanTableData(sysTable.chatLogs,Player)
579 if newLogTable then
580 essentialsEvent:FireClient(Player,'List','Chat Logs',true,true,newLogTable,returnPSAMessage(Player,'logs'))
581 end
582 elseif Command == "logs" then
583 local newLogTable = cleanTableData(sysTable.Logs,Player)
584 if newLogTable then
585 essentialsEvent:FireClient(Player,'List','Admin Logs',true,true,newLogTable,returnPSAMessage(Player,'logs'))
586 end
587 elseif Command == "joinlogs" then
588 essentialsEvent:FireClient(Player,'List','Join Logs',true,true,sysTable.joinLogs)
589-- elseif Command == "pbans" then
590-- local pbanData = sysTable.dsBanCache
591-- local Table = {}
592-- if pbanData then
593-- for a,b in next,pbanData do
594-- table.insert(Table,{b[1],b[2],b[3]})
595-- end
596-- end
597-- essentialsEvent:FireClient(Player,'List','Permanent Bans',true,true,Table)
598 elseif Command == "shutdownlogs" then
599 local shutdownData = DataCategory.get('Shutdown Logs')
600 local Table = {}
601 if shutdownData then
602 for a,b in next,shutdownData do
603 table.insert(Table,b[1]..', '..b[2])
604 end
605 end
606 essentialsEvent:FireClient(Player,'List','Shutdown Logs',false,true,Table)
607 elseif Command == "bans" then
608 local Table = {}
609 for a,b in next,sysTable.Permissions.Banned do
610 table.insert(Table,b..', '..a)
611 end
612 essentialsEvent:FireClient(Player,'List','Bans',true,true,Table)
613 elseif Command == "debuglogs" then
614 essentialsEvent:FireClient(Player,'List','Debug',true,true,sysTable.debugLogs)
615 end
616end
617
618function Funcs.displayMessage(Args)
619 local Player = Args[1]
620 local Command = Args[2]
621 local combinedArgs = ""
622 if Command ~= "smtest" then
623 if not Args[3] then return end
624 for a,b in pairs(Args) do
625 if a > 2 then
626 combinedArgs = combinedArgs..b..' '
627 end
628 end
629 end
630
631 if Command == "sm" then
632 if combinedArgs ~= "" then
633 for a,b in next,playerService:GetPlayers() do
634 local cleansedData = ""
635 local cannotShow = false
636
637 local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
638 if Cleaned and newData then
639 cleansedData = newData
640 elseif not Cleaned then
641 if newData and newData:lower():match('cannot communicate with') then
642 cannotShow = true
643 essentialsEvent:FireClient(b,'Message',sysTable.serverMessage,'Your chat settings prevent you from seeing messages.')
644 else
645 if not newData then
646 essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
647 return
648 else
649 cleansedData = newData
650 end
651 end
652 end
653
654 if not cannotShow then
655 essentialsEvent:FireClient(b,'Message',sysTable.serverMessage,cleansedData)
656 end
657 end
658 end
659 elseif Command == "countdown" then
660 if Args[3] and tonumber(Args[3]) then
661 if not sysTable.countingDown then
662 sysTable.countingDown = true
663 spawn(function()
664 for i=Args[3],0,-1 do
665 if sysTable.countingDown then
666 essentialsEvent:FireAllClients('Hint','Countdown',i)
667 wait(1)
668 if i == 1 then
669 sysTable.countingDown = false
670-- essentialsEvent:FireAllClients('Hint','Countdown',"BEGIN!")
671 break
672 end
673 else
674 break
675 end
676 end
677 end)
678 end
679 elseif Args[3] and tostring(Args[3]) and Args[3]:lower() == 'off' then
680 sysTable.countingDown = false
681 end
682 elseif Command == "m" then
683 if combinedArgs ~= "" then
684 for a,b in next,playerService:GetPlayers() do
685 local cleansedData = ""
686 local cannotShow = false
687
688 local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
689 if Cleaned and newData then
690 cleansedData = newData
691 elseif not Cleaned then
692 if newData and newData:lower():match('cannot communicate with') then
693 cannotShow = true
694 essentialsEvent:FireClient(b,'Message',sysTable.serverMessage,'Your chat settings prevent you from seeing messages.')
695 else
696 if not newData then
697 essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
698 return
699 else
700 cleansedData = newData
701 end
702 end
703 end
704
705 if not cannotShow then
706 essentialsEvent:FireClient(b,'Message',Player.Name,cleansedData)
707 end
708 end
709 end
710 elseif Command == "h" then
711 if combinedArgs ~= "" then
712 for a,b in next,playerService:GetPlayers() do
713 local cleansedData = ""
714 local cannotShow = false
715
716 local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
717 if Cleaned and newData then
718 cleansedData = newData
719 elseif not Cleaned then
720 if newData and newData:lower():match('cannot communicate with') then
721 cannotShow = true
722 essentialsEvent:FireClient(b,'Hint',sysTable.serverMessage,'Your chat settings prevent you from seeing messages.')
723 else
724 if not newData then
725 essentialsEvent:FireClient(Player,'Hint',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
726 return
727 else
728 cleansedData = newData
729 end
730 end
731 end
732
733 if not cannotShow then
734 essentialsEvent:FireClient(b,'Hint',Player.Name,cleansedData)
735 end
736 end
737 end
738 elseif Command == "smtest" then
739 essentialsEvent:FireAllClients('Message',"Server Message",[[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ut facilisis massa. Proin ac ex vestibulum turpis bibendum pellentesque vitae ac dolor. Sed a ipsum a neque dictum posuere at auctor odio. Vivamus eleifend, metus eget egestas ornare, tellus ante aliquam ligula, sit amet aliquam lorem orci vitae mi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In aliquam dictum nisi, et vestibulum mauris hendrerit ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam non diam dolor. In nec turpis euismod, auctor ante vitae, gravida neque. Integer quis cursus ligula. Maecenas ultricies mi at nisl pretium, eu tristique sem suscipit. Cras nec tempor ante. Cras ut euismod augue. Nunc faucibus leo vulputate sem porta, nec pellentesque nulla ornare. Duis sit amet mauris sed ante hendrerit sodales. Aenean pretium velit tempor ex commodo hendrerit.
740
741Curabitur tincidunt ac elit quis euismod. Curabitur lobortis, mi vel dapibus pretium, quam mauris scelerisque arcu, et ultrices arcu lectus vel urna. Nunc aliquet metus augue, nec congue sem porta sit amet. Sed maximus, nunc quis sollicitudin tincidunt, felis neque fringilla neque, vel auctor risus metus vitae magna. Vivamus purus dolor, blandit id sem vel, ultricies congue lacus. Integer non congue leo. Donec a magna a metus feugiat scelerisque dapibus nec tortor. Mauris suscipit eu neque vel imperdiet. Duis leo arcu, malesuada quis erat sed, luctus tincidunt mauris. Integer vel diam sed nibh bibendum porta ut non risus. Suspendisse vulputate posuere auctor. Aliquam et velit quis justo sollicitudin cursus id in dui. Vestibulum tincidunt, purus non pharetra rhoncus, lacus ligula volutpat mi, quis rhoncus dolor arcu id urna. Nulla facilisi. Sed sodales dignissim eros ac interdum. Integer posuere viverra nisl sit amet suscipit.
742
743In sem sem, elementum non sodales ut, gravida a diam. Pellentesque eget sem ullamcorper velit convallis congue sed laoreet leo. Fusce nibh dolor, dictum in odio quis, gravida aliquet purus. Sed efficitur lacus justo, a eleifend est dignissim sed. Nunc egestas in est nec vulputate. Phasellus vel lacinia ante, eu molestie eros. Suspendisse potenti. Sed et volutpat arcu. Cras eu consequat risus. Nam efficitur sed ligula ut lacinia. Aenean vehicula venenatis nibh, ac commodo est dictum sit amet. Curabitur aliquet tempor purus id scelerisque.
744
745Cras eget elementum mi. Aenean sollicitudin id lectus eget tincidunt. Curabitur sit amet massa et tortor lobortis fermentum. Suspendisse vel lacinia turpis. Suspendisse risus sapien, finibus at risus sed, interdum volutpat urna. Vivamus vestibulum orci nec nibh ultrices, at volutpat diam dignissim. Praesent vel erat aliquet, sollicitudin massa sed, cursus massa. Sed sed purus quis sem feugiat condimentum consectetur vitae lacus. Suspendisse vel auctor erat, efficitur pellentesque orci.
746
747Vivamus risus nisl, gravida ac consequat vel, semper quis mauris. Vivamus feugiat purus nibh, vitae ultricies sapien feugiat nec. Aliquam dapibus nec felis vel rhoncus. Morbi id tellus at nisi placerat luctus vel in risus. Curabitur a nisi vel velit semper porta. Curabitur consectetur dignissim nunc, et tempor ipsum feugiat ut. Aenean sem nibh, iaculis vel interdum eget, volutpat nec lorem.]])
748 end
749end
750
751local function unadminPlayer(Player,Victim)
752 local playerPermission = returnPermission(Player)
753 local Permission = returnPermission(Victim)
754 for c,d in next,sysTable.Permissions do
755 if playerPermission > Permission and d[2] and d[2][tostring(Victim.UserId)] then
756 essentialsEvent:FireClient(Victim,'Admin Update',nil,nil,nil,customCommands(Player),0)
757 d[2][tostring(Victim.UserId)] = nil
758 end
759 end
760end
761
762function Funcs.Admin(Args)
763 local Player = Args[1]
764 local Command = Args[2]
765 if not Args[3] then return end
766 local playerPermission = returnPermission(Player)
767 local Victims = returnPlayers(Player,Args[3],Args[2])
768 if not Victims then return end
769 if Command == "superadmin" then
770 for a,b in next,Victims do
771 if b ~= Player then
772 local Permission = returnPermission(b)
773 if not sysTable.Permissions.superAdmins[2][tostring(b.UserId)] and (playerPermission > Permission) then
774 if Permission ~= 0 then
775 unadminPlayer(Player,b)
776 end
777 sysTable.Permissions.superAdmins[2][tostring(b.UserId)] = b.Name
778 essentialsEvent:FireClient(b,'Admin Update',"Super Admin",'Click for Commands',{'Cmds'},customCommands(Player),3)
779 end
780 end
781 end
782 elseif Command == "admin" then
783 for a,b in next,Victims do
784 if b ~= Player then
785 local Permission = returnPermission(b)
786 if not sysTable.Permissions.Admins[2][tostring(b.UserId)] and (playerPermission > Permission) then
787 if Permission ~= 0 then
788 unadminPlayer(Player,b)
789 end
790 sysTable.Permissions.Admins[2][tostring(b.UserId)] = b.Name
791 essentialsEvent:FireClient(b,'Admin Update',"Administrator",'Click for Commands',{'Cmds'},customCommands(Player),2)
792 end
793 end
794 end
795 elseif Command == "mod" then
796 for a,b in next,Victims do
797 if b ~= Player then
798 local Permission = returnPermission(b)
799 if not sysTable.Permissions.Mods[2][tostring(b.UserId)] and (playerPermission > Permission) then
800 if Permission ~= 0 then
801 unadminPlayer(Player,b)
802 end
803 sysTable.Permissions.Mods[2][tostring(b.UserId)] = b.Name
804 essentialsEvent:FireClient(b,'Admin Update',"Moderator",'Click for Commands',{'Cmds'},customCommands(Player),1)
805 end
806 end
807 end
808 elseif Command == "unadmin" then
809 for a,b in next,Victims do
810 local Permission = returnPermission(b)
811 for c,d in next,sysTable.Permissions do
812 if playerPermission > Permission and d[2] and d[2][tostring(b.UserId)] then
813 essentialsEvent:FireClient(b,'Admin Update',nil,nil,nil,customCommands(Player),0)
814 d[2][tostring(b.UserId)] = nil
815 end
816 end
817 end
818 end
819end
820
821function Funcs.addLog(Args)
822 local Player = Args[1]
823 if Args[3] then
824 local combinedArgs = ""
825 for a,b in pairs(Args) do
826 if a > 2 then
827 combinedArgs = combinedArgs..b..' '
828 end
829 end
830 if combinedArgs ~= "" then
831 local cleansedData = ""
832 local Cleaned,newData = cleanUserData(combinedArgs,Player)
833 if Cleaned and newData then
834 cleansedData = newData
835 elseif not Cleaned then
836 cleansedData = newData or "An error occurred."
837 end
838
839 addLog(sysTable.debugLogs,'[A] '..cleansedData)
840 end
841 end
842end
843
844local function generateID()
845 return httpService:GenerateGUID(false)
846end
847
848function Funcs.PM(Args)
849 local Player = Args[1]
850 if Args[3] and Args[4] then
851 local combinedArgs
852 for a,b in pairs(Args) do
853 if a > 3 then
854 if not combinedArgs then
855 combinedArgs = b
856 else
857 combinedArgs = combinedArgs..' '..b
858 end
859 end
860 end
861 local Victims = returnPlayers(Player,Args[3],Args[2])
862 if not Victims then return end
863 for a,b in next,Victims do
864 local Sending = true
865 local cleansedData = ""
866 local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
867
868 if Cleaned and newData then
869 cleansedData = newData
870 elseif not Cleaned then
871 if newData and newData:lower():match('cannot communicate with') then
872 Sending = false
873 essentialsEvent:FireClient(Player,'Hint','Error','You cannot communicate with '..b.Name..'.')
874 else
875 if not newData then
876 essentialsEvent:FireClient(Player,'Hint',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
877 return
878 else
879 cleansedData = newData
880 end
881 end
882 end
883
884 if Sending then
885 local ID = generateID()
886 sysTable.outboundMessages[ID] = b
887 essentialsEvent:FireClient(b,'PM',Player.Name,cleansedData,nil,ID)
888 end
889 end
890 end
891end
892
893function Funcs.Shutdown(Args)
894 local Player = Args[1]
895 if not sysTable.shuttingDown then
896 sysTable.shuttingDown = {}
897 sysTable.shuttingDown.Name = tostring(Player)
898 sysTable.shuttingDown.UserId = tostring(Player.UserId)
899
900 pluginEvent:Fire("Shutdown Logs",{Player,"Shutdown the server with "..tostring(#playerService:GetPlayers())..' player(s).'})
901 essentialsEvent:FireClient(Player,'Hint','Server','Shutting down..')
902 essentialsEvent:FireAllClients('Message',sysTable.serverMessage,sysTable.shutdownReason)
903
904 wait(1)
905
906 for a,b in next,playerService:GetPlayers() do
907 b:Kick('Basic Admin\n'..sysTable.shutdownReason)
908 end
909 end
910end
911
912function Funcs.lockSever(Args)
913 local Player = Args[1]
914 local Cmd = Args[2]
915 if Cmd == "slock" then
916 if not sysTable.serverLocked then
917 sysTable.serverLocked = true
918 essentialsEvent:FireClient(Player,'Hint','Success','The server has been locked.')
919 else
920 essentialsEvent:FireClient(Player,'Hint','Error','The server was already locked.')
921 end
922 elseif Cmd == "unslock" then
923 if sysTable.serverLocked then
924 sysTable.serverLocked = false
925 essentialsEvent:FireClient(Player,'Hint','Success','The server has been unlocked.')
926 else
927 essentialsEvent:FireClient(Player,'Hint','Error','The server was already unlocked.')
928 end
929 end
930end
931
932function Funcs.Teleport(Args)
933 local Player = Args[1]
934 local playerRoot = Player.Character:FindFirstChild('HumanoidRootPart')
935 if Args[2] == 'tp' then
936 if not Args[4] then return end
937 local Target = returnPlayers(Player,Args[4],Args[2])[1] if not Target then return end
938 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
939 for a,b in pairs(Players) do
940 if b.Character:FindFirstChild('HumanoidRootPart') and Target.Character:FindFirstChild('HumanoidRootPart') then
941 b.Character.HumanoidRootPart.CFrame = (Target.Character.HumanoidRootPart.CFrame*CFrame.Angles(0,math.rad(90/#Players*a),0)*CFrame.new(5+.2*#Players,0,0))*CFrame.Angles(0,math.rad(90),0)
942 end
943 end
944 elseif Args[2] == 'to' then
945 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
946 for a,b in pairs(Players) do
947 if b.Character:FindFirstChild('HumanoidRootPart') then
948 playerRoot.CFrame = (b.Character.HumanoidRootPart.CFrame*CFrame.Angles(0,math.rad(90/#Players*a),0)*CFrame.new(5+.2*#Players,0,0))*CFrame.Angles(0,math.rad(90),0)
949 end
950 end
951 elseif Args[2] == 'bring' then
952 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
953 for a,b in pairs(Players) do
954 if b.Character:FindFirstChild('HumanoidRootPart') then
955 b.Character.HumanoidRootPart.CFrame = (playerRoot.CFrame*CFrame.Angles(0,math.rad(90/#Players*a),0)*CFrame.new(5+.2*#Players,0,0))*CFrame.Angles(0,math.rad(90),0)
956 end
957 end
958 end
959end
960
961function Funcs.Team(Args)
962 local Player = Args[1]
963 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
964 if not Args[4] then return end
965 for a,b in next,Players do
966 for c,d in next,Teams:GetChildren() do
967 if d.Name:lower():find(Args[4]:lower()) == 1 then
968 b.TeamColor = d.TeamColor
969 end
970 end
971 end
972end
973
974function Funcs.Info(Args)
975 local Player = Args[1]
976 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
977 local memberShip
978 for a,b in pairs(Players) do
979 if b.MembershipType == Enum.MembershipType.None then
980 memberShip = 'NBC'
981 elseif b.MembershipType == Enum.MembershipType.BuildersClub then
982 memberShip = 'BC'
983 elseif b.MembershipType == Enum.MembershipType.TurboBuildersClub then
984 memberShip = 'TBC'
985 elseif b.MembershipType == Enum.MembershipType.OutrageousBuildersClub then
986 memberShip = 'OBC'
987 end
988 essentialsEvent:FireClient(Player,'Message','Info for '..b.Name,'Account Age: '..b.AccountAge..'\nBuilders Club: '..memberShip)
989 end
990end
991
992local function checkAsset(Id,Type)
993 if tonumber(Id) then
994 local Asset
995 local success,message = pcall(function()
996 Asset = Market:GetProductInfo(tonumber(Id))
997 end)
998 if success then
999 if Asset.AssetTypeId == Type then
1000 return true
1001 end
1002 end
1003 end
1004 return false
1005end
1006
1007function Funcs.Gear(Args)
1008 local Player = Args[1]
1009 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1010 if not Args[4] then return end
1011 for a,b in pairs(Players) do
1012 if checkAsset(Args[4],19) then
1013 local insertedItem = insertService:LoadAsset(Args[4]):GetChildren()[1] if not insertedItem then return end
1014 insertedItem.Parent = b.Backpack
1015 end
1016 end
1017end
1018
1019local bansLoaded,trelloDown = false,false
1020
1021function Funcs.debugStats(Args)
1022 local Player = Args[1]
1023 local tempTable = {
1024 "HttpEnabled: "..tostring(httpCheck()),
1025 "Trello Down: "..tostring(trelloDown),
1026 "Trello Enabled: "..tostring(sysTable.trelloEnabled),
1027 "Trello Board: "..tostring(sysTable.trelloBoard),
1028 "Ban Len: "..string.len(tostring(httpService:JSONEncode(DataCategory.get("Bans") or {}))),
1029 "Donor Len: "..string.len(tostring(httpService:JSONEncode(DataCategory.get("Cape Data") or {}))),
1030 "DataStore: "..tostring(sysTable.dataCategory),
1031 }
1032 essentialsEvent:FireClient(Player,'List','Debug Stats',false,true,tempTable)
1033end
1034
1035function Funcs.Hat(Args)
1036 local Player = Args[1]
1037 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1038 if not Args[4] then return end
1039 for a,b in pairs(Players) do
1040 if checkAsset(Args[4],8) or checkAsset(Args[4],41) or checkAsset(Args[4],42) or checkAsset(Args[4],43) or checkAsset(Args[4],44) or checkAsset(Args[4],45) or checkAsset(Args[4], 46) then
1041 local insertedItem = insertService:LoadAsset(Args[4]):GetChildren()[1] if not insertedItem then return end
1042 if insertedItem:IsA('Accoutrement') then
1043 for c,d in pairs(insertedItem:GetDescendants()) do
1044 if d:IsA('Script') then
1045 d:Destroy()
1046 end
1047 end
1048 insertedItem.Parent = b.Character
1049 else
1050 insertedItem:Destroy()
1051 end
1052 end
1053 end
1054end
1055
1056function Funcs.Donor(Args)
1057 local Player = Args[1]
1058 if sysTable.donorPerks then
1059 if sysTable.donorCache[tostring(Player.UserId)] then
1060 essentialsEvent:FireClient(Player,'Donor')
1061 else
1062 Market:PromptPurchase(Player, sysTable.donorID)
1063 end
1064 end
1065end
1066
1067local function banId(playerId,playerName,Reason)
1068 -- if checkDebugger(playerId) then return end
1069
1070 for _,Player in next,playerService:GetPlayers() do
1071 if tostring(Player.UserId) == tostring(playerId) then
1072 Player:Kick('Basic Admin\n'..sysTable.exploitMessage)
1073 end
1074 end
1075
1076 local Succ,Msg = pcall(function()
1077 local pBans = DataCategory.update('Bans',function(Previous)
1078 local toReturn
1079 if Previous then
1080 toReturn = unpack({Previous})
1081 else
1082 toReturn = {}
1083 end
1084 if toReturn ~= {} then
1085 for a,b in next,toReturn do
1086 if tonumber(b[1]) == tonumber(playerId) then
1087 table.remove(toReturn,a)
1088 return
1089 end
1090 end
1091 end
1092 table.insert(toReturn,{playerId,playerName,Reason})
1093 return toReturn
1094 end)
1095 end)
1096
1097 pluginEvent:Fire("Exploit Logs",{playerId})
1098 addLog(sysTable.debugLogs,'[Exploiter] '..playerId..', '..playerName)
1099end
1100
1101local function checkTable(Table,Data)
1102 for a,b in next,Table do
1103 if tostring(b[1]) == tostring(Data) then
1104 return true
1105 end
1106 end
1107 return
1108end
1109
1110function Funcs.permBan(Args)
1111 local Player = Args[1]
1112 local Cmd = Args[2]
1113 local Players = returnPlayers(Player,Args[3],Args[2])
1114 if Cmd == "pban" or Cmd == "pbanid" then
1115 local Succ,Msg = pcall(function()
1116 local victimTable = {}
1117 local victimName,victimId
1118 local givenReason
1119 if Args[4] then
1120 local combinedArgs = ""
1121 for a,b in pairs(Args) do
1122 if a > 3 then
1123 combinedArgs = combinedArgs..b..' '
1124 end
1125 end
1126 if combinedArgs ~= "" then
1127 givenReason = combinedArgs
1128 end
1129 end
1130
1131 if not Players then
1132 local Succ,Msg = pcall(function()
1133 if Cmd == "pban" then
1134 victimId = tonumber(playerService:GetUserIdFromNameAsync(Args[3]))
1135 victimName = tostring(playerService:GetNameFromUserIdAsync(victimId))
1136 else
1137 victimId = tonumber(Args[3])
1138 victimName = tostring(playerService:GetNameFromUserIdAsync(Args[3]))
1139 end
1140 end)
1141 if Succ and not Msg then
1142 if not DataCategory.get(tostring(victimId)..'_Banned') then
1143 if returnPerms_ID(victimId) >= returnPermission(Player) then
1144 return
1145 else
1146 table.insert(victimTable,{victimId,victimName})
1147 local dateTable = {timeAndDate.Date()}
1148 local dateString = dateTable[2]..'/'..dateTable[3]..'/'..string.sub(dateTable[1],3)
1149 local reasonString = ''
1150
1151 if givenReason then
1152 local Cleaned,newData = cleanUserData(givenReason,Player,false)
1153 if Cleaned and newData then
1154 givenReason = newData
1155 elseif not Cleaned then
1156 if newData and newData:lower():match('cannot communicate with') then
1157 givenReason = 'A reason was provided, but your privacy settings prevent you from seeing it.'
1158 else
1159 if not newData then
1160 essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from communicating in any way, so a reason will not be provided.')
1161 givenReason = nil
1162 else
1163 givenReason = newData
1164 end
1165 end
1166 end
1167
1168 if givenReason ~= nil then
1169 reasonString = ', Reason: '..givenReason
1170 end
1171 end
1172
1173 local Succ,Msg = pcall(function()
1174 DataCategory.set(tostring(victimId)..'_Banned',{Victim = victimName,Banner = Player.Name,Date = dateString, Reason = givenReason})
1175 end)
1176
1177 if not Succ and Msg then
1178 essentialsEvent:FireClient(Player,'Message','Error','An error occurred while trying to ban that user.')
1179 end
1180
1181 for a,b in next,playerService:GetPlayers() do
1182 if tostring(b.UserId) == tostring(victimId) then
1183 b:Kick('Basic Admin\n'..sysTable.banReason..'\nPermanently'..reasonString)
1184 end
1185 end
1186 end
1187 end
1188 else
1189 essentialsEvent:FireClient(Player,'Message','Error','An error occurred while trying to "'..Cmd..'"'..'\n'..Msg)
1190 return
1191 end
1192 else
1193 for a,b in next,Players do
1194 if returnPerms_ID(b.UserId) < returnPermission(Player) then
1195 table.insert(victimTable,{b.UserId,b.Name})
1196 local dateTable = {timeAndDate.Date()}
1197 local dateString = dateTable[2]..'/'..dateTable[3]..'/'..string.sub(dateTable[1],3)
1198 local reasonString = ''
1199
1200 if givenReason then
1201 local Cleaned,newData = cleanUserData(givenReason,Player,false)
1202 if Cleaned and newData then
1203 givenReason = newData
1204 elseif not Cleaned then
1205 if newData and newData:lower():match('cannot communicate with') then
1206 givenReason = 'A reason was provided, but your privacy settings prevent you from seeing it.'
1207 else
1208 if not newData then
1209 essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from communicating in any way, so a reason will not be provided.')
1210 givenReason = nil
1211 else
1212 givenReason = newData
1213 end
1214 end
1215 end
1216
1217 if givenReason ~= nil then
1218 reasonString = ', Reason: '..givenReason
1219 end
1220 end
1221
1222 local Succ,Msg = pcall(function()
1223 DataCategory.set(tostring(b.UserId)..'_Banned',{Victim = b.Name,Banner = Player.Name,Date = dateString,Reason = givenReason})
1224 end)
1225
1226 if not Succ and Msg then
1227 essentialsEvent:FireClient(Player,'Message','Error','An error occurred while trying to ban that user.')
1228 end
1229
1230 b:Kick('Basic Admin\n'..sysTable.banReason..'\nPermanently'..reasonString)
1231 end
1232 end
1233 end
1234
1235 if #victimTable > 0 then
1236 local toSend
1237 for a,b in next,victimTable do
1238 if not toSend then
1239 toSend = b[1]..', '..b[2]
1240 else
1241 toSend = toSend..' | '..b[1]..', '..b[2]
1242 end
1243 end
1244 essentialsEvent:FireClient(Player,'Hint',"Permanently Banned",toSend)
1245 else
1246 essentialsEvent:FireClient(Player,'Hint',"Error","User already banned, or an unexpected error occurred.")
1247 end
1248 end)
1249 if Msg then
1250 addLog(sysTable.debugLogs,'Funcs.permBan, "pban", Message: '..Msg or "Err")
1251 end
1252 elseif Cmd == "unpban" or Cmd == "unpbanid" then
1253 local Succ,Msg = pcall(function()
1254 local victimId,victimName,Removed
1255 local Succ,Msg = pcall(function()
1256 if Cmd == "unpban" then
1257 victimId = tonumber(playerService:GetUserIdFromNameAsync(Args[3]))
1258 victimName = tostring(playerService:GetNameFromUserIdAsync(victimId))
1259 else
1260 victimId = tonumber(Args[3])
1261 victimName = tostring(playerService:GetNameFromUserIdAsync(Args[3]))
1262 end
1263 end)
1264 if Succ and not Msg then
1265 local bannedStatus
1266 local Succ,Msg = pcall(function()
1267 bannedStatus = DataCategory.get(tostring(victimId)..'_Banned')
1268 end)
1269 if Succ and bannedStatus then
1270 local Succ,Msg = pcall(function()
1271 DataCategory.remove(tostring(victimId)..'_Banned')
1272 end)
1273 if Succ then
1274 Removed = true
1275 elseif Msg then
1276 addLog(sysTable.debugLogs,'Funcs.permBan remove, "unpban", Message: '..Msg or "Err")
1277 end
1278 elseif Succ and not bannedStatus then
1279 local Succ,Msg = pcall(function()
1280 local pBans = DataCategory.update('Bans',function(Previous)
1281 local toReturn
1282 if Previous then
1283 toReturn = Previous
1284 for a,b in next,toReturn do
1285 if tonumber(b[1]) == tonumber(victimId) then
1286 Removed = true
1287 table.remove(toReturn,a)
1288 break
1289 end
1290 end
1291 end
1292 return toReturn
1293 end)
1294 end)
1295 if Msg then
1296 addLog(sysTable.debugLogs,'Funcs.permBan update, "unpban", Message: '..Msg or "Err")
1297 end
1298 end
1299 else
1300 essentialsEvent:FireClient(Player,'Message','Error','An error occurred while trying to "'..Cmd..'"'..'\n'..Msg)
1301 return
1302 end
1303 if Removed then
1304 essentialsEvent:FireClient(Player,'Hint',"Un-Permanently Banned",victimId..', '..victimName)
1305 else
1306 essentialsEvent:FireClient(Player,'Hint',"Error","User was not already banned, or an unexpected error occurred.")
1307 end
1308 end)
1309 if Msg then
1310 addLog(sysTable.debugLogs,'Funcs.permBan, "unpban", Message: '..Msg or "Err")
1311 end
1312 elseif Cmd == "pbans" then
1313 essentialsEvent:FireClient(Player,'PBans',returnPSAMessage(Player,'legacy_pban_dep'))
1314 end
1315end
1316
1317function Funcs.changeStats(Args)
1318 local Player = Args[1]
1319 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1320 if Args[4] and Args[5] then
1321 local combinedArgs = ''
1322 for i,v in pairs(Args) do
1323 if i > 4 then
1324 combinedArgs = combinedArgs..v..' '
1325 end
1326 end
1327
1328 if string.sub(combinedArgs,#combinedArgs,#combinedArgs) == ' ' then
1329 combinedArgs = string.sub(combinedArgs,1,#combinedArgs-1)
1330 end
1331
1332 local cleansedVal = ''
1333 if not tonumber(combinedArgs) then -- for number values
1334 local Cleaned,newData = cleanUserData(combinedArgs,Player,false)
1335
1336 if Cleaned and newData then
1337 cleansedVal = newData
1338 elseif not Cleaned then
1339 cleansedVal = newData
1340 end
1341 else
1342 cleansedVal = tonumber(combinedArgs)
1343 end
1344
1345 for a,b in pairs(Players) do
1346 if b:FindFirstChild('leaderstats') then
1347 local leaderStats = b:FindFirstChild('leaderstats')
1348 for c,d in pairs(leaderStats:children()) do
1349 if d.Name:lower():find(Args[4]:lower()) == 1 then
1350 d.Value = cleansedVal
1351 end
1352 end
1353 end
1354 end
1355 end
1356end
1357
1358function Funcs.healPlayer(Args)
1359 local Player = Args[1]
1360 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1361 for a,b in next,Players do
1362 if b.Character and b.Character:FindFirstChild('Humanoid') then
1363 local Hum = b.Character:WaitForChild('Humanoid')
1364 Hum.Health = Hum.MaxHealth
1365 end
1366 end
1367end
1368
1369function Funcs.setJump(Args)
1370 local Player = Args[1]
1371 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1372 if Args[4] and tonumber(Args[4]) then
1373 for a,b in next,Players do
1374 if b.Character and b.Character:FindFirstChild('Humanoid') then
1375 local Hum = b.Character:WaitForChild('Humanoid')
1376 Hum.JumpPower = Args[4]
1377 end
1378 end
1379 end
1380end
1381
1382function Funcs.insertModel(Args)
1383 local Player = Args[1]
1384 if Args[3] and tonumber(Args[3]) and Player.Character then
1385 local rootPart = Player.Character:WaitForChild('HumanoidRootPart')
1386 local assetId = Args[3]
1387 local Model = insertService:LoadAsset(assetId)
1388 Model.Parent = Workspace
1389 Model.Name = 'BAE Inserted'
1390 Model:MakeJoints()
1391 Model:MoveTo(rootPart.Position)
1392 end
1393end
1394
1395function Funcs.crashPlayer(Args)
1396 local Player = Args[1]
1397 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1398 for a,b in next,Players do
1399 essentialsEvent:FireClient(b,'Crash')
1400 end
1401end
1402
1403function Funcs.Fly(Args)
1404 local Player = Args[1]
1405 local Command = Args[2]
1406 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1407 if Command == "fly" then
1408 for a,b in next,Players do
1409 essentialsEvent:FireClient(b,'Fly',true)
1410 end
1411 elseif Command == "unfly" then
1412 for a,b in next,Players do
1413 essentialsEvent:FireClient(b,'Fly',false)
1414 end
1415 end
1416end
1417
1418function Funcs.Utility(Args)
1419 local Player = Args[1]
1420 local Players = returnPlayers(Player,Args[3],Args[2])
1421 if not Players then return end
1422 if Args[2] == 'btools' then
1423 for a,b in pairs(Players) do
1424 local F3XClone = F3X:Clone()
1425 F3XClone.Parent = b.Backpack
1426 end
1427 elseif Args[2] == 'segway' then
1428 for a,b in pairs(Players) do
1429 local segwayClone = Segway:Clone()
1430 segwayClone.Parent = b.Backpack
1431 end
1432 end
1433end
1434
1435function Funcs.getAdmin(Args)
1436 local Player = Args[1]
1437 Market:PromptPurchase(Player, sysTable.adminId)
1438end
1439
1440function Funcs.Give(Args)
1441 local Player = Args[1]
1442 local Players = returnPlayers(Player,Args[3],Args[2])
1443 for a,b in pairs(Players) do
1444 for c,d in pairs(sysTable.toolLocation:GetDescendants()) do
1445 if (d:IsA('Tool') or d:IsA('HopperBin')) and not playerService:GetPlayerFromCharacter(d.Parent) then
1446 if Args[4]:lower() ~= 'all' then
1447 if d.Name:lower():find(Args[4]:lower()) == 1 then
1448 d:Clone().Parent = b.Backpack
1449 if Args[2] == 'startergear' then
1450 d:Clone().Parent = b.StarterGear
1451 end
1452 end
1453 else
1454 d:Clone().Parent = b.Backpack
1455 if Args[2] == 'startergear' then
1456 d:Clone().Parent = b.StarterGear
1457 end
1458 end
1459 end
1460 end
1461 end
1462end
1463
1464local function awardCape(Player,cColor,cMat,cDecal,cTrans)
1465 local b = Player
1466 if not cColor then
1467 cColor = BrickColor.new('Really black')
1468 else
1469 cColor = BrickColor.new(tostring(cColor))
1470 end
1471 local cMat = cMat or Enum.Material.SmoothPlastic
1472 local cDecal = cDecal
1473 if b.Character and b.Character:FindFirstChild('Humanoid') and not b.Character:FindFirstChild('BAE Cape') then
1474 local Hum = b.Character.Humanoid
1475 local basePart
1476 local Ded
1477 if Hum.RigType == Enum.HumanoidRigType.R15 then
1478 basePart = b.Character:WaitForChild('UpperTorso')
1479 Ded = 2
1480 else
1481 basePart = b.Character:WaitForChild('Torso')
1482 Ded = 1.8
1483 end
1484
1485 local capePart = Instance.new("Part", b.Character)
1486 capePart.Name = "BAE Cape"
1487 capePart.Anchored = false
1488 capePart.CanCollide = false
1489 capePart.TopSurface = 0
1490 capePart.BottomSurface = 0
1491 capePart.BrickColor = cColor
1492 capePart.Material = cMat
1493 capePart.Transparency = cTrans or 0
1494 capePart.FormFactor = Enum.FormFactor.Custom
1495 capePart.Size = Vector3.new(.2,.2,.2)
1496
1497 local capeMesh = Instance.new('BlockMesh',capePart)
1498 capeMesh.Scale = Vector3.new(9,17.5,.25)
1499
1500 local capeDecal = Instance.new("Decal", capePart)
1501 capeDecal.Face = 2
1502
1503 if cDecal then
1504 capeDecal.Texture = "rbxassetid://"..cDecal
1505 else
1506 capeDecal.Texture = "rbxassetid://"..419363338
1507 end
1508
1509 local capeMotor = Instance.new("Motor", capePart)
1510 capeMotor.Name = "Motor"
1511 capeMotor.Part0 = capePart
1512 capeMotor.Part1 = basePart
1513 capeMotor.MaxVelocity = 0.05
1514 capeMotor.C0 = CFrame.new(0,Ded,0) * CFrame.Angles(0,math.rad(90),0)
1515 capeMotor.C1 = CFrame.new(0,basePart.Size.Z,basePart.Size.Z/2-0.015) * CFrame.Angles(0,math.rad(90),0)
1516 elseif b.Character and b.Character:FindFirstChild('Humanoid') and b.Character:FindFirstChild('BAE Cape') then
1517 b.Character['BAE Cape']:Destroy()
1518 awardCape(Player,cColor,cMat,cDecal,cTrans)
1519 end
1520end
1521
1522local function saveCapeData(Player,Data)
1523 local Succ,Msg = pcall(function()
1524 if not Data then
1525 DataCategory.remove(Player.UserId..'_Cape')
1526 else
1527 DataCategory.update(Player.UserId..'_Cape',function(Previous)
1528 Previous = Data
1529 return Previous
1530 end)
1531 end
1532 end)
1533
1534 local capeData = DataCategory.get(Player.UserId..'_Cape')
1535 if not capeData and not Data then
1536 local Succ,Msg = pcall(function()
1537 DataCategory.update('Cape Data',function(Previous)
1538 local toReturn
1539 if Previous then
1540 toReturn = unpack({Previous})
1541 else
1542 toReturn = {}
1543 end
1544 if toReturn ~= {} then
1545 for a,b in next,toReturn do
1546 if tostring(b[1]) == tostring(Player.UserId) then
1547 table.remove(toReturn,a)
1548 end
1549 end
1550 end
1551 return toReturn
1552 end)
1553 end)
1554 return Succ,Msg
1555 else
1556 return Succ,Msg
1557 end
1558end
1559
1560local function getCapeData(Player)
1561 local capeData
1562 local Succ,Msg = pcall(function()
1563 capeData = DataCategory.get(Player.UserId..'_Cape')
1564 end)
1565
1566 if Succ and capeData then
1567 return capeData
1568 elseif Succ and not capeData then
1569 local oldCape
1570 local Succ,Msg = pcall(function()
1571 oldCape = DataCategory.get("Cape Data")
1572 end)
1573 if Succ and oldCape then
1574 local Succ,Msg = pcall(function()
1575 for a,b in next,oldCape do
1576 if b and b[1] ~= nil and b[3] ~= nil then
1577 if tostring(Player.UserId) == tostring(b[1]) then
1578 capeData = b[3]
1579 break
1580 end
1581 end
1582 end
1583 end)
1584 if Succ and capeData then
1585 return capeData
1586 end
1587 end
1588 end
1589end
1590
1591function Funcs.Cape(Args)
1592 local Player = Args[1]
1593 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1594 if Args[2] == "awardcape" then
1595 for a,b in pairs(Players) do
1596 awardCape(b)
1597 end
1598 elseif Args[2] == 'uncape' then
1599 for a,b in next,Players do
1600 if b.Character and b.Character:FindFirstChild('BAE Cape') then
1601 b.Character['BAE Cape']:Destroy()
1602 end
1603 end
1604 end
1605end
1606
1607local function LoadScript(Source)
1608 local Func,Err = loadStringModule(Source,getfenv())
1609 if Func then
1610 Func()
1611 return true
1612 else
1613 return Err
1614 end
1615end
1616
1617function Funcs.doScript(Args)
1618 local Player = Args[1]
1619 if Args[3] ~= nil then
1620 local combinedArgs = ''
1621 for i,v in pairs(Args) do
1622 if i > 2 then
1623 combinedArgs = combinedArgs..v..' '
1624 end
1625 end
1626 local Response = LoadScript(combinedArgs)
1627 if Response == true then
1628 essentialsEvent:FireClient(Player,'Hint','Success','Executed code.')
1629 else
1630 essentialsEvent:FireClient(Player,'Message','Script Error',Response)
1631 end
1632 end
1633end
1634
1635local function format_int(number)
1636 local i, j, minus, int, fraction = tostring(number):find('([-]?)(%d+)([.]?%d*)')
1637 int = int:reverse():gsub("(%d%d%d)", "%1,")
1638 return minus .. int:reverse():gsub("^,", "") .. fraction
1639end
1640
1641function Funcs.itemStats(Args)
1642 local Player = Args[1]
1643 if not Args[3] then return end
1644 for Segment in Args[3]:gmatch('([^,]+)') do
1645 local lowerSegment = Segment:lower()
1646 local Table = {}
1647 local prodInfo
1648 local prodName
1649 local Amt,priceInRS = 0,0
1650 local Succ, Fail = pcall(function()
1651 prodInfo = Market:GetProductInfo(lowerSegment)
1652 end)
1653 if Succ then
1654 prodName = prodInfo.Name
1655 priceInRS = (prodInfo.PriceInRobux) or 0
1656 if priceInRS ~= 0 then
1657 Amt = (priceInRS-(priceInRS*0.30))*prodInfo.Sales
1658 end
1659 table.insert(Table,'Name: '..prodInfo.Name)
1660 table.insert(Table,'Created: '..string.sub(prodInfo.Created,1,10))
1661 table.insert(Table,'Updated: '..string.sub(prodInfo.Updated,1,10))
1662 table.insert(Table,'Creator: '..prodInfo.Creator.Name)
1663 table.insert(Table,'IsForSale: '..tostring(prodInfo.IsForSale))
1664 table.insert(Table,'Price: R$'..format_int(priceInRS))
1665 table.insert(Table,'Sales: '..format_int(prodInfo.Sales))
1666 table.insert(Table,'Est. R$: '..format_int(Amt))
1667 if Amt >= 100000 then -- 0.0025
1668 table.insert(Table,'Est. DevEx: $'..format_int(0.0025*Amt)..'*')
1669 table.insert(Table,'*DevEx rates apply, this is an est.')
1670 else
1671 table.insert(Table,'Est. DevEx: Not enough R$')
1672 end
1673 end
1674 essentialsEvent:FireClient(Player,'List','Statistics',false,true,Table)
1675 end
1676end
1677
1678function Funcs.Jump(Args)
1679 local Player = Args[1]
1680 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1681 for a,b in next,Players do
1682 if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('Humanoid') then
1683 local playerHum = b.Character:WaitForChild('Humanoid')
1684 playerHum.Jump = true
1685 end
1686 end
1687end
1688
1689function Funcs.Sit(Args)
1690 local Player = Args[1]
1691 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1692 for a,b in next,Players do
1693 if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('Humanoid') then
1694 local playerHum = b.Character:WaitForChild('Humanoid')
1695 playerHum.Sit = true
1696 end
1697 end
1698end
1699
1700function Funcs.View(Args)
1701 local Player = Args[1]
1702 if Args[2] == 'view' then
1703 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1704 for a,b in next,Players do
1705 if b.Character:FindFirstChild('Humanoid') then
1706 essentialsEvent:FireClient(Player,'View',b.Character.Humanoid)
1707 end
1708 end
1709 elseif Args[2] == 'unview' then
1710 essentialsEvent:FireClient(Player,'View',nil)
1711 end
1712end
1713
1714function Funcs.Buy(Args)
1715 local Player = Args[1]
1716 if not Args[3] or not Args[4] then return end
1717 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1718 for a,b in next,Players do
1719 Market:PromptPurchase(b, tonumber(Args[4]))
1720 end
1721end
1722
1723function Funcs.Clean(Args)
1724 local Player = Args[1]
1725 for a,Obj in next, workspace:GetChildren() do
1726 if Obj:IsA('Accoutrement') then
1727 if playerService:GetPlayerFromCharacter(Obj.Parent) then
1728 return
1729 else
1730 Debris:AddItem(Obj,0.1)
1731 end
1732 end
1733 end
1734end
1735
1736function Funcs.Speed(Args)
1737 local Player = Args[1]
1738 if not Args[4] and not (tostring(Args[4]) and tonumber(Args[4])) then return end
1739 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1740 for a,b in next,Players do
1741 if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('Humanoid') then
1742 local playerHum = b.Character:WaitForChild('Humanoid')
1743 playerHum.WalkSpeed = Args[4]
1744 end
1745 end
1746end
1747
1748function Funcs.Refresh(Args)
1749 local Player = Args[1]
1750 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1751 for a,b in next,Players do
1752 if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('HumanoidRootPart') then
1753 spawn(function()
1754 local rootPart = b.Character:WaitForChild('HumanoidRootPart')
1755 local prevPos = rootPart.CFrame
1756 b:LoadCharacter()
1757 repeat
1758 if b == nil or b.Parent == nil then
1759 return
1760 end
1761 wait()
1762 until b.Character ~= nil
1763 rootPart = b.Character:WaitForChild('HumanoidRootPart')
1764 rootPart.CFrame = prevPos
1765 end)
1766 runService.Heartbeat:wait()
1767 end
1768 end
1769end
1770
1771function Funcs.Rejoin(Args)
1772 local Player = Args[1]
1773 teleportService:Teleport(game.PlaceId, Player)
1774end
1775
1776local function checkAsset(Id,Type)
1777 if tonumber(Id) then
1778 local Asset
1779 local success,message = pcall(function()
1780 Asset = Market:GetProductInfo(tonumber(Id))
1781 end)
1782 if success then
1783 if Asset.AssetTypeId == Type then
1784 return true
1785 end
1786 end
1787 end
1788 return false
1789end
1790
1791function Funcs.Place(Args)
1792 local Player = Args[1]
1793 if not Args[4] then return end
1794 if checkAsset(Args[4],9) then
1795 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1796 for a,b in next,Players do
1797 teleportService:Teleport(Args[4], b)
1798 end
1799 end
1800end
1801
1802function Funcs.God(Args)
1803 local Player = Args[1]
1804 if Args[2] == "god" or Args[2] == "ungod" then
1805 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1806 for a,b in next,Players do
1807 if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('Humanoid') then
1808 local playerHum = b.Character:WaitForChild('Humanoid')
1809 if Args[2] == "god" then
1810 playerHum.MaxHealth = math.huge
1811 playerHum.Health = math.huge
1812 elseif Args[2] == "ungod" then
1813 playerHum.MaxHealth = 100
1814 playerHum.Health = 100
1815 end
1816 end
1817 end
1818 end
1819end
1820
1821function Funcs.FF(Args)
1822 local Player = Args[1]
1823 if Args[2] == "ff" or Args[2] == "unff" then
1824 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1825 for a,b in next,Players do
1826 if b and b:IsDescendantOf(playerService) and b.Character and b.Character:FindFirstChild('Humanoid') then
1827 local playerHum = b.Character:WaitForChild('Humanoid')
1828 if Args[2] == "ff" then
1829 local FF = Instance.new('ForceField',b.Character)
1830 elseif Args[2] == "unff" then
1831 for a,b in next,b.Character:GetChildren() do
1832 if b:IsA('ForceField') then
1833 b:Destroy()
1834 end
1835 end
1836 end
1837 end
1838 end
1839 end
1840end
1841
1842function Funcs.Time(Args)
1843 local Player = Args[1]
1844 if Args[3] then
1845 local combinedArgs
1846 for i,v in pairs(Args) do
1847 if i > 2 then
1848 if not combinedArgs then
1849 combinedArgs = v
1850 else
1851 combinedArgs = combinedArgs..v
1852 end
1853 end
1854 end
1855 Lighting.TimeOfDay = combinedArgs
1856 end
1857end
1858
1859function Funcs.removeTools(Args)
1860 local Player = Args[1]
1861 local Command = Args[2]
1862 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1863 if Command == "removetools" then
1864 for a,b in next,Players do
1865 for a,b in next,b.Backpack:GetChildren() do
1866 if b:IsA('Tool') or b:IsA('HopperBin') then
1867 b:Destroy()
1868 end
1869 end
1870 end
1871 elseif Command == "clearstartergear" then
1872 for a,b in next,Players do
1873 for c,d in pairs(b.Backpack:GetChildren()) do
1874 if d:IsA('Tool') or d:IsA('HopperBin') then
1875 d:Destroy()
1876 end
1877 end
1878 for e,f in pairs(b.StarterGear:GetChildren()) do
1879 if f:IsA('Tool') or f:IsA('HopperBin') then
1880 f:Destroy()
1881 end
1882 end
1883 end
1884 end
1885end
1886
1887function Funcs.Clear(Args)
1888 local Player = Args[1]
1889 local Command = Args[2]
1890 sysTable.countingDown = false
1891 essentialsEvent:FireAllClients('Clear')
1892end
1893
1894function Funcs.manipulateServer(Args)
1895 local Player = Args[1]
1896 if Args[2] == 'createserver' then
1897 if Args[3] then
1898 local Place = game.PlaceId
1899 local Code = teleportService:ReserveServer(Place)
1900 local combinedArgs = ''
1901 for i,v in pairs(Args) do
1902 if i > 2 then
1903 combinedArgs = combinedArgs..v..' '
1904 end
1905 end
1906
1907 local cleanedData
1908 local Cleaned,newData = cleanUserData(combinedArgs,Player,false)
1909
1910 if Cleaned and newData then
1911 cleanedData = newData
1912 elseif not Cleaned then
1913 if not newData then
1914 essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from communicating in any way.')
1915 return
1916 else
1917 cleanedData = newData
1918 end
1919 end
1920
1921 if cleanedData == combinedArgs then
1922 table.insert(sysTable.privateServers,{Code,Place,combinedArgs})
1923 else
1924 essentialsEvent:FireClient(Player,'Hint','Error','Your server name was censored, please try again.')
1925 end
1926 end
1927 elseif Args[2] == 'deleteserver' then
1928 if #sysTable.privateServers > 0 then
1929 if Args[3] then
1930 local combinedArgs = ''
1931 for i,v in pairs(Args) do
1932 if i > 2 then
1933 combinedArgs = combinedArgs..v..' '
1934 end
1935 end
1936 for a,b in next,sysTable.privateServers do
1937 if combinedArgs == b[3] then
1938 table.remove(sysTable.privateServers,sysTable.privateServers[b])
1939 end
1940 end
1941 end
1942 else
1943 essentialsEvent:FireClient(Player,'Hint',"Error",'No private servers found.')
1944 end
1945 elseif Args[2] == 'joinserver' then -- service.TeleportService:TeleportToPrivateServer(code.ID,code.Code,{v})
1946 if #sysTable.privateServers > 0 then
1947 if Args[3] then
1948 local combinedArgs = ''
1949 for i,v in pairs(Args) do
1950 if i > 2 then
1951 combinedArgs = combinedArgs..v..' '
1952 end
1953 end
1954 for a,b in next,sysTable.privateServers do
1955 if combinedArgs == b[3] then
1956 teleportService:TeleportToPrivateServer(b[2],b[1],{Player})
1957 end
1958 end
1959 end
1960 else
1961 essentialsEvent:FireClient(Player,'Hint',"Error",'No private servers found.')
1962 end
1963 elseif Args[2] == 'privateservers' then
1964 if #sysTable.privateServers > 0 then
1965 local tempTab = {}
1966 for a,b in pairs(sysTable.privateServers) do
1967 table.insert(tempTab,b[3])
1968 end
1969 essentialsEvent:FireClient(Player,'List','Private Servers',false,true,tempTab)
1970 else
1971 essentialsEvent:FireClient(Player,'Hint',"Error",'No private servers found.')
1972 end
1973 elseif Args[2] == 'toreserved' then
1974 if Args[4] then
1975 if #sysTable.privateServers > 0 then
1976 local combinedArgs = ''
1977 for i,v in pairs(Args) do
1978 if i > 3 then
1979 combinedArgs = combinedArgs..v..' '
1980 end
1981 end
1982 for a,b in next,sysTable.privateServers do
1983 if combinedArgs == b[3] then
1984 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
1985 for c,d in pairs(Players) do
1986 teleportService:TeleportToPrivateServer(b[2],b[1],{d})
1987 end
1988 end
1989 end
1990 else
1991 essentialsEvent:FireClient(Player,'Hint',"Error",'No private servers found.')
1992 end
1993 end
1994 end
1995end
1996
1997function Funcs.viewTools(Args)
1998 local Player = Args[1]
1999 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
2000 for a,b in next,Players do
2001 local Backpack = b:FindFirstChild('Backpack')
2002 if Backpack then
2003 local Tools = {}
2004 for c,d in next,Backpack:GetChildren() do
2005 if d:IsA('Tool') or d:IsA('HopperBin') then
2006 table.insert(Tools,tostring(d))
2007 end
2008 end
2009
2010 if b.Character ~= nil then
2011 local onCharacter = b.Character:FindFirstChildOfClass('Tool') or b.Character:FindFirstChildOfClass('HopperBin')
2012 if onCharacter then
2013 table.insert(Tools,tostring(onCharacter))
2014 end
2015 end
2016
2017 essentialsEvent:FireClient(Player,'List',b.Name..'\'s Backpack',false,true,Tools)
2018 end
2019 end
2020end
2021
2022function Funcs.namePlayer(Args)
2023 local Player = Args[1]
2024 local Players = returnPlayers(Player,Args[3],Args[2]) if not Players then return end
2025 if Args[2] == 'name' then
2026 local combinedArgs = ''
2027 for i,v in pairs(Args) do
2028 if i > 3 then
2029 combinedArgs = combinedArgs..v..' '
2030 end
2031 end
2032
2033 for a,b in next,Players do
2034 local filteredName = ''
2035
2036 sysTable.localNames[b] = {Sender = b,Data = combinedArgs} -- Would store Player, but we can't filter users offline!
2037 local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
2038
2039 if Cleaned and newData then
2040 filteredName = newData
2041 elseif not Cleaned then
2042 filteredName = newData
2043 end
2044
2045 for c,d in next,playerService:GetPlayers() do
2046 essentialsEvent:FireClient(d,'Local Name',b,filteredName)
2047 end
2048 end
2049 elseif Args[2] == 'unname' then
2050 for a,b in next,Players do
2051 for c,d in next,playerService:GetPlayers() do
2052 if sysTable.localNames[b] then
2053 sysTable.localNames[b] = nil
2054 end
2055 essentialsEvent:FireClient(d,'Local Name',b)
2056 end
2057 end
2058 end
2059end
2060
2061function Funcs.playSong(Args)
2062 local Player = Args[1]
2063 if Args[2] == 'play' then
2064 local function playSound(songId)
2065 if checkAsset(songId,3) then
2066 local S = Instance.new('Sound',workspace)
2067 S.Name = 'BAE Sound'
2068 S.SoundId = 'rbxassetid://'..Args[3]
2069 S.Volume = 1
2070 S.Pitch = 1
2071 if Args[4] ~= nil then
2072 S.Looped = true
2073 end
2074 S:Play()
2075 if S.TimeLength <= 0 then
2076 essentialsEvent:FireClient(Player,'Hint','Loading..',Market:GetProductInfo(Args[3]).Name)
2077 local changedCon
2078 changedCon = S.Changed:Connect(function(Prop)
2079 if Prop == "TimeLength" and S.TimeLength > 0 then
2080 changedCon:Disconnect()
2081 essentialsEvent:FireClient(Player,'Hint','Now Playing',Market:GetProductInfo(Args[3]).Name)
2082 elseif Prop == "Parent" and S.Parent == nil then
2083 changedCon:Disconnect()
2084 end
2085 end)
2086 else
2087 essentialsEvent:FireClient(Player,'Hint','Now Playing',Market:GetProductInfo(Args[3]).Name)
2088 end
2089 end
2090 end
2091 local S = workspace:FindFirstChild('BAE Sound')
2092 if not S then
2093 playSound(Args[3])
2094 else
2095 local changedCon
2096 changedCon = S.Changed:Connect(function(Prop)
2097 if Prop == "Parent" and S.Parent == nil then
2098 changedCon:Disconnect()
2099 playSound(Args[3])
2100 end
2101 end)
2102
2103 S:Destroy()
2104 end
2105 elseif Args[2] == 'stopsound' then
2106 local S = workspace:FindFirstChild('BAE Sound')
2107 if S then
2108 S:Destroy()
2109 end
2110 elseif Args[2] == 'volume' then
2111 if tonumber(Args[3]) then
2112 local Vol = Args[3]
2113 if workspace:FindFirstChild('BAE Sound') then
2114 local S = workspace:FindFirstChild('BAE Sound')
2115 S.Volume = Vol
2116 end
2117 end
2118 elseif Args[2] == 'pitch' then
2119 if tonumber(Args[3]) then
2120 local Pitch = Args[3]
2121 if workspace:FindFirstChild('BAE Sound') then
2122 local S = workspace:FindFirstChild('BAE Sound')
2123 S.Pitch = Pitch
2124 end
2125 end
2126 end
2127end
2128
2129local function checkTrelloBan(Player)
2130 if checkTrello() then
2131 if not bansLoaded then
2132 repeat
2133 if bansLoaded then
2134 break
2135 end
2136 wait(0.5)
2137 until bansLoaded
2138 end
2139 if sysTable.trelloBanned[tonumber(Player.UserId)] then
2140 Player:Kick('System\nTrello Ban\n'..sysTable.banReason)
2141 end
2142 end
2143end
2144
2145local function updateTrello()
2146 pcall(function()
2147 local Trello,downMessage = trelloApi(sysTable.trelloAppKey,sysTable.trelloToken)
2148 if Trello ~= false and Trello ~= nil then
2149 trelloDown = false
2150
2151 local Lists = Trello.getLists(sysTable.trelloBoard)
2152 local banList = Trello.getListObj(Lists,"Ban List")
2153 local tempBans = {}
2154
2155 bansLoaded = false
2156 if banList then
2157 local Cards = Trello.getCards(banList.id)
2158 for a,b in pairs(Cards) do
2159 if b.name:match('(.*):(.*)') then
2160 local Name,ID = b.name:match('(.*):(.*)')
2161 table.insert(tempBans,{ID,Name})
2162 end
2163 end
2164 sysTable.trelloBanned = {}
2165 for e,f in pairs(tempBans) do
2166 if tonumber(f[1]) and f[1] ~= nil and f[2] ~= nil then
2167 sysTable.trelloBanned[tonumber(f[1])] = f[2]
2168 else
2169 local Blank = (f[1] or "nil")..', '..(f[2] or "nil")
2170 addLog(sysTable.debugLogs,'Basic Admin Essentials\nBan ID: "'..Blank..'" is not properly formatted on the Trello Bans List.')
2171 end
2172 end
2173 bansLoaded = true
2174 for g,h in next,playerService:GetPlayers() do
2175 checkTrelloBan(h)
2176 end
2177 end
2178 else
2179 trelloDown = true
2180 addLog(sysTable.debugLogs,'Trello Error: '..tostring(downMessage or "???"))
2181 end
2182 end)
2183end
2184
2185Market.PromptPurchaseFinished:connect(function(Player, Asset, isPurchased)
2186 if isPurchased then
2187 if Asset == sysTable.donorID and sysTable.donorPerks then
2188 if not sysTable.donorCache[tostring(Player.UserId)] then
2189 sysTable.donorCache[tostring(Player.UserId)] = {}
2190 end
2191 essentialsEvent:FireClient(Player,'Hint',"Success",'Purchased Donor Perks')
2192 essentialsEvent:FireClient(Player,'Donor')
2193 end
2194 end
2195end)
2196
2197local function getCommand(Message,Player)
2198 if sysTable.Prefix ~= "" and (string.sub(Message,1,1) == sysTable.Prefix or string.sub(Message,1,1) == sysTable.actionPrefix) then
2199 for a,b in next,Commands do
2200 for Segment in string.gmatch(Message, "%a+") do
2201 if Segment:lower() == b[1]:lower() and string.sub(Message,1,1) == b[2] then
2202 return string.sub(Message,2)
2203 end
2204 end
2205 end
2206 elseif sysTable.Prefix == "" then
2207 if string.sub(Message,1,1) == sysTable.actionPrefix then
2208 for a,b in next,Commands do
2209 for Segment in string.gmatch(Message, "%a+") do
2210 if Segment:lower() == b[1]:lower() and (string.sub(Message,1,1) == sysTable.actionPrefix and b[2] == sysTable.actionPrefix) then
2211 return string.sub(Message,2)
2212 end
2213 end
2214 end
2215 else
2216 for a,b in next,Commands do
2217 for Segment in string.gmatch(Message, "%a+") do
2218 if Segment:lower() == b[1]:lower() and (string.sub(Message,1,1) ~= sysTable.actionPrefix and b[2] ~= sysTable.actionPrefix) then
2219 return string.sub(Message,1)
2220 end
2221 end
2222 end
2223 end
2224 end
2225end
2226
2227local function checkGroup(Player)
2228 local Succ,Msg,groupInfo
2229 local adminLevel = 0
2230
2231 for i=1,3 do
2232 Succ,Msg = pcall(function()
2233 groupInfo = groupService:GetGroupsAsync(Player.UserId)
2234 end)
2235 if Succ then
2236 break
2237 end
2238 end
2239
2240 if Succ and groupInfo then
2241 for a,b in next,sysTable.groupConfig do
2242 for c,d in next,groupInfo do
2243 if (tonumber(d.Id) == tonumber(b['Group ID'])) then
2244 if b['Tolerance Type'] == '==' then
2245 if tonumber(d.Rank) == tonumber(b['Group Rank']) then
2246 if b['Admin Level'] > adminLevel then
2247 adminLevel = b['Admin Level']
2248 end
2249 end
2250 elseif b['Tolerance Type'] == '>=' then
2251 if tonumber(d.Rank) >= tonumber(b['Group Rank']) then
2252 if b['Admin Level'] > adminLevel then
2253 adminLevel = b['Admin Level']
2254 end
2255 end
2256 elseif b['Tolerance Type'] == '<=' then
2257 if tonumber(d.Rank) <= tonumber(b['Group Rank']) then
2258 if b['Admin Level'] > adminLevel then
2259 adminLevel = b['Admin Level']
2260 end
2261 end
2262 end
2263 end
2264 end
2265 end
2266 end
2267
2268 return adminLevel,(not Succ)
2269end
2270
2271local function insertPermissions(Player)
2272 local groupPermissions,Err = checkGroup(Player)
2273 if Err then
2274 error(Err)
2275 end
2276
2277 if groupPermissions > 0 then
2278 for a,b in next,sysTable.Permissions do
2279 if b[1] then
2280 if b[1] == groupPermissions and not b[2][tostring(Player.UserId)] and returnPermission(Player) < b[1] then
2281 b[2][tostring(Player.UserId)] = Player.Name
2282 end
2283 end
2284 end
2285 end
2286end
2287
2288local function onChatted(Message, Player)
2289 local Command = getCommand(Message,Player)
2290 if not Command then return end
2291 local Arguments = {}
2292 table.insert(Arguments, Player)
2293 for Segment in string.gmatch(Command, "%S+") do
2294 if not Arguments[2] then
2295 table.insert(Arguments,Segment:lower())
2296 else
2297 table.insert(Arguments,Segment)
2298 end
2299 end
2300 if Arguments[2] ~= nil then
2301 for a,b in next,Commands do
2302 local tempPerm = returnPermission(Player)
2303 if b[1]:lower() == Arguments[2]:lower() and tempPerm >= b[4] then
2304 if (tempPerm == 0 and b[4] == 0 and not sysTable.publicCommands) and b[3] ~= Funcs.Donor then
2305 return
2306 end
2307 local Success,errorMessage = pcall(function()
2308 b[3](Arguments)
2309 end)
2310 if errorMessage then
2311 addLog(sysTable.debugLogs,'"'..Arguments[2]..'"| Error: '..errorMessage)
2312 essentialsEvent:FireClient(Player,'Message','Function Error','Name: "'..Arguments[2]..'"\n'..errorMessage)
2313 elseif Success then
2314 local cleanedMessage
2315
2316 local Cleaned,newData = cleanUserData(Message,Player,false)
2317 if Cleaned and newData then
2318 cleanedMessage = newData
2319 elseif not Cleaned then
2320 cleanedMessage = newData
2321 end
2322
2323 if cleanedMessage then
2324 pluginEvent:Fire("Admin Logs",{Player,newData})
2325 else
2326 addLog(sysTable.Logs,{Sender = Player,Bypass = true,Data = '(super safechat) executed "'..tostring(b[1] or "???")..'"',Tag = true})
2327 return
2328 end
2329
2330 addLog(sysTable.Logs,{Sender = Player,Data = cleanedMessage}) -- Store the filter instance once we can use it properly.
2331 end
2332 return
2333 end
2334 end
2335 end
2336end
2337
2338local function generateKey(Player)
2339 local Key = Player.Name..'_.'
2340 for i=1,100 do
2341 Key = Key..string.char(math.random(255))
2342 end
2343 if not sysTable.Keys[Key] then
2344 return Key
2345 else
2346 repeat
2347 wait(0.1)
2348 local Key = Player.Name..'_.'
2349 for i=1,100 do
2350 Key = Key..string.char(math.random(255))
2351 end
2352 until not sysTable.Keys[Key]
2353 return Key
2354 end
2355end
2356
2357local function getPlayerGui(Player)
2358 local playerGui = Player:FindFirstChild('PlayerGui')
2359
2360 if not playerGui then
2361 local Connection
2362 Connection = Player.ChildAdded:Connect(function(Obj)
2363 if Obj:IsA('PlayerGui') then
2364 Connection:Disconnect()
2365 Connection = nil
2366 playerGui = Obj
2367 end
2368 end)
2369 end
2370
2371 repeat
2372 if playerGui then
2373 break
2374 else
2375 playerGui = Player:FindFirstChild('PlayerGui')
2376 if playerGui then
2377 break
2378 end
2379 if not Player or Player == nil or not Player:IsDescendantOf(playerService) then
2380 return
2381 end
2382 end
2383 wait()
2384 until playerGui ~= nil
2385
2386 return playerGui
2387end
2388
2389local function managePlayer(Player)
2390 addLog(sysTable.joinLogs,Player.Name)
2391
2392 local Succ,Msg = pcall(function()
2393 insertPermissions(Player)
2394 end)
2395
2396 if not Succ and Msg then
2397 addLog(sysTable.debugLogs,"insertPermissions Error: "..tostring((Msg or "")))
2398 essentialsEvent:FireClient(Player,'Message','Error','An error occurred with Roblox while trying to give you admin permissions. Try rejoining to resolve this issue.')
2399 end
2400
2401 if sysTable.serverLocked then
2402 if returnPermission(Player) == 0 then
2403 Player:Kick('Basic Admin\n'..sysTable.serverLockReason)
2404 return ('"'..Player.Name..'" | User ID: '..Player.UserId..' tried to join but the server is locked.')
2405 end
2406 end
2407
2408 if sysTable.Permissions.Banned[tostring(Player.UserId)] then
2409 Player:Kick('Basic Admin\n'..sysTable.banReason)
2410 return ('"'..Player.Name..'" | User ID: '..Player.UserId..' is banned and cannot join the server.')
2411 end
2412
2413 local trelloBanned
2414 if bansLoaded then
2415 trelloBanned = checkTrelloBan(Player)
2416 if trelloBanned then
2417 return ('"'..Player.Name..'" | User ID: '..Player.UserId..' is trello-banned and cannot join the server.')
2418 end
2419 else
2420 spawn(function()
2421 checkTrelloBan(Player)
2422 end)
2423 end
2424
2425 if not pendingPSAs[Player] then
2426 pendingPSAs[Player] = {}
2427 end
2428
2429 if not pendingPSAs[Player]['logs'] then
2430 if os.time() < 1524117600 then
2431 local hasAcknowledged = checkForAcknowledgement(Player,'logs')
2432 if not hasAcknowledged then
2433 pendingPSAs[Player]['logs'] = {
2434 Title = "Announcement regarding Chatlogs and Logs.",
2435 Info = "Recently, there have been updates to Basic Admin regarding the Chatlog and Log commands. There have been efforts to make this admin more Roblox filter compliant, in accordance to their filtering policies. However, it has come to my attention that, that goal is not exactly attainable at this moment in time due to the lack of API support.\n\nWhat this means for you, is that chatlogs and logs are now functional again."
2436 }
2437 end
2438 end
2439 end
2440
2441 local Succ,Msg = pcall(function()
2442 local banData = DataCategory.get(Player.UserId..'_Banned')
2443 if banData then
2444 local reasonString = ''
2445 if banData.Reason then
2446 local tempString = ''
2447 local Cleaned,newData = cleanUserData(banData.Reason,Player,false)
2448
2449 if Cleaned and newData then
2450 tempString = newData
2451 elseif not Cleaned and not newData then
2452 tempString = '\nA reason was provided, but your privacy settings prevent you from seeing it.'
2453 end
2454
2455 if tempString ~= '' then
2456 reasonString = ', Reason: '..tempString
2457 end
2458 end
2459
2460 Player:Kick('Basic Admin\n'..sysTable.banReason..'\nPermanently'..reasonString)
2461 return ('"'..Player.Name..'" | User ID: '..Player.UserId..' is perm-banned and cannot join the server. (New)')
2462 else
2463 local oldBans
2464 local Succ,Msg = pcall(function()
2465 oldBans = DataCategory.get("Bans")
2466 end)
2467 if Succ and oldBans then
2468 for c,d in next,oldBans do
2469 if d and d[1] ~= nil then
2470 if tostring(d[1]) == tostring(Player.UserId) then -- and not DataCategory.get(Player.UserId..'_Banned')
2471 local additionalString = "."
2472 if d[3] ~= nil then
2473 additionalString = ", "..tostring(d[3])
2474 end
2475 Player:Kick('Basic Admin\n'..sysTable.banReason..'\nPermanently'..additionalString)
2476 return ('"'..Player.Name..'" | User ID: '..Player.UserId..' is perm-banned and cannot join the server. (Old)')
2477 end
2478 end
2479 end
2480 end
2481 end
2482 end)
2483
2484 if not Succ and Msg then
2485 addLog(sysTable.debugLogs,"DataStore Error: "..tostring((Msg) or "nil"))
2486 elseif Succ and Msg then
2487 return Msg
2488 end
2489
2490 local playerGui = getPlayerGui(Player)
2491 if playerGui then
2492 local clientUIClone = essentialsUI:Clone()
2493 clientUIClone.Parent = playerGui
2494 else
2495 return ('"'..Player.Name..'" | User ID: '..Player.UserId..' was unable to get a PlayerGui obtained, they could have left.')
2496 end
2497
2498 Player.Chatted:connect(function(Message)
2499 local cleanedMessage
2500 local function Redo()
2501 local Succ,Msg = pcall(function()
2502 cleanedMessage = chatService:FilterStringForBroadcast(Message,Player)
2503 end)
2504 if not Succ then
2505 wait(1)
2506 Redo()
2507 end
2508 end
2509
2510 Redo()
2511
2512 -- We have to store the broadcasted version of what the user said,
2513 -- due to the lack of features supplied to inadequately and properly
2514 -- filter for a chat log system.
2515
2516 if cleanedMessage then
2517 pluginEvent:Fire("Chat Logs",{Player,cleanedMessage})
2518 addLog(sysTable.chatLogs,{Sender = Player,Data = cleanedMessage})
2519 end
2520
2521 onChatted(Message,Player)
2522 end)
2523
2524 spawn(function()
2525 pcall(function()
2526 for otherPlayer,nameData in next,sysTable.localNames do
2527 local filteredName
2528 local Cleaned,newData = cleanUserData(nameData.Data,nameData.Sender,Player)
2529
2530 if Cleaned then
2531 filteredName = newData
2532 end
2533
2534 if filteredName then
2535 for c,d in next,playerService:GetPlayers() do
2536 essentialsEvent:FireClient(Player,'Local Name',otherPlayer,filteredName)
2537 end
2538 end
2539 end
2540 end)
2541 end)
2542
2543 Player.CharacterAdded:connect(function(Character)
2544 spawn(function()
2545 pcall(function()
2546 if sysTable.localNames[Player] and sysTable.localNames[Player].Sender and sysTable.localNames[Player].Data then
2547 local filteredName
2548 local Cleaned,newData = cleanUserData(sysTable.localNames[Player].Data,sysTable.localNames[Player].Sender,Player)
2549
2550 if Cleaned then
2551 filteredName = newData
2552 end
2553
2554 if filteredName then
2555 for c,d in next,playerService:GetPlayers() do
2556 essentialsEvent:FireClient(d,'Local Name',Player,filteredName)
2557 end
2558 end
2559 end
2560 end)
2561 end)
2562
2563 if sysTable.donorPerks then
2564 local capeData = getCapeData(Player)
2565 if capeData then
2566 awardCape(Player,capeData[1],capeData[2],capeData[3],capeData[4])
2567 end
2568 end
2569 end)
2570
2571 spawn(function()
2572 if Player.Character ~= nil and not Player.Character:FindFirstChild('BAE Cape') then
2573 if sysTable.donorPerks then
2574 local capeData = getCapeData(Player)
2575 if capeData then
2576 awardCape(Player,capeData[1],capeData[2],capeData[3],capeData[4])
2577 end
2578 end
2579 end
2580 end)
2581
2582 if not sysTable.Permissions.gameOwners[tostring(Player.UserId)] then
2583 if (Player.UserId == game.CreatorId) or (game.CreatorType == Enum.CreatorType.Group and Player:GetRankInGroup(game.CreatorId) == 255) then
2584 sysTable.Permissions.gameOwners[2][tostring(Player.UserId)] = Player.Name
2585 end
2586 end
2587
2588 local Key = generateKey(Player)
2589 local permissionLevel = returnPermission(Player)
2590 local Setup = {
2591 ['Permission'] = permissionLevel,
2592 ['Key'] = Key,
2593 ['Prefix'] = sysTable.Prefix,
2594 ['actionPrefix'] = sysTable.actionPrefix,
2595 ['Version'] = sysTable.adminVersion,
2596 ['donorEnabled'] = sysTable.donorPerks,
2597 ['Debugging'] = sysTable.creatorDebugging,
2598 ['commandsTable'] = customCommands(Player)
2599 }
2600
2601 local Reply,Succ,Msg
2602 local Tries = 0
2603
2604 repeat
2605 if (not Player or Player.Parent ~= playerService) or Tries > 3 then
2606 break
2607 end
2608 Succ,Msg = pcall(function()
2609 Reply = essentialsFunction:InvokeClient(Player,'Client Setup',Setup)
2610 end)
2611 Tries = Tries + 1
2612 wait()
2613 until Succ
2614
2615 if Succ and Reply and Reply == Key then
2616 sysTable.Keys[tostring(Player.UserId)] = Key
2617 essentialsEvent:FireClient(Player,'Communications Ready')
2618 else
2619 return ('"'..Player.Name..'" | User ID: '..Player.UserId..', an error occurred while waiting for their setup response.')
2620 end
2621
2622 pcall(function()
2623 if not sysTable.donorCache[tostring(Player.UserId)] and Market:PlayerOwnsAsset(Player, sysTable.donorID) and sysTable.donorPerks then
2624 sysTable.donorCache[tostring(Player.UserId)] = {}
2625 essentialsEvent:FireClient(Player,'Notif','Donor Perks','Click to view',{'Donate'})
2626 end
2627 end)
2628
2629 return ('Set up User "'..Player.Name..'" | User ID: '..Player.UserId),true
2630end
2631
2632local function locateCommand(Name)
2633 for a,b in next,Commands do
2634 if tostring(b[1]) == tostring(Name) then
2635 return b
2636 end
2637 end
2638end
2639
2640local function Setup(Plugins,Config)
2641 if not replicatedStorage:FindFirstChild('Basic Admin Essentials') then
2642 essentialsFolder = Instance.new('Folder',replicatedStorage)
2643 essentialsFolder.Name = "Basic Admin Essentials"
2644 essentialsEvent = Instance.new('RemoteEvent',essentialsFolder)
2645 essentialsEvent.Name = "Essentials Event"
2646 essentialsFunction = Instance.new('RemoteFunction',essentialsFolder)
2647 essentialsFunction.Name = "Essentials Function"
2648 local clientClone = clientCode:Clone()
2649 clientClone.Parent = starterPlayer.StarterPlayerScripts
2650 sysTable.systemColor = Config['System Color'] or sysTable.systemColor
2651 for a,b in next,essentialsUI['Base Clip']:GetChildren() do
2652 if b:IsA('Frame') then
2653 if b.Name == "Container" and b:FindFirstChild('Template') then
2654 local Inner = b:FindFirstChild('Template'):FindFirstChild('Inner')
2655 if Inner then
2656 Inner.BackgroundColor3 = sysTable.systemColor
2657 end
2658 elseif b.Name == "Donor Template" then
2659 b.Overlay.BackgroundColor3 = sysTable.systemColor
2660 b.BackgroundColor3 = sysTable.systemColor
2661 elseif b.Name == "Personal Message Template" then
2662 b.Bottom.BackgroundColor3 = sysTable.systemColor
2663 b.Top.Controls.Decoration.BackgroundColor3 = sysTable.systemColor
2664 b.Top.Controls.Exit.BackgroundColor3 = sysTable.systemColor
2665 b.Top.BackgroundColor3 = sysTable.systemColor
2666 else
2667 b.BackgroundColor3 = sysTable.systemColor
2668 end
2669 end
2670 end
2671 else
2672 return nil
2673 end
2674
2675 addLog(sysTable.debugLogs,"Loader: "..tostring((Config['Loader ID'] or "nil")))
2676
2677 if Config['Prefix'] and #(Config['Prefix']) > 1 then
2678 Config['Prefix'] = nil
2679 end
2680
2681 sysTable.Prefix = Config['Prefix'] or sysTable.Prefix
2682 sysTable.Permissions.superAdmins[2] = Config['Super Admins'] or {}
2683 sysTable.Permissions.Admins[2] = Config['Admins'] or {}
2684 sysTable.Permissions.Mods[2] = Config['Mods'] or {}
2685 sysTable.Permissions.Banned = Config['Banned'] or {}
2686 sysTable.kickReason = Config['Kick Reason'] or sysTable.kickReason
2687 sysTable.banReason = Config['Ban Reason'] or sysTable.banReason
2688 sysTable.shutdownReason = Config['Shutdown Reason'] or sysTable.shutdownReason
2689 sysTable.serverMessage = Config['Server Message'] or sysTable.serverMessage
2690 sysTable.groupConfig = Config['Group Configuration'] or sysTable.groupConfig
2691 sysTable.serverLockReason = Config['Server Lock Reason'] or sysTable.serverLockReason
2692
2693 if Config['Command Confirmation'] ~= nil then
2694 sysTable.commandConfirmation = Config['Command Confirmation']
2695 end
2696
2697 if Config['Datastore Key'] ~= nil then
2698 sysTable.dataCategory = Config['Datastore Key']
2699 end
2700
2701 DataCategory = dataModule(sysTable.dataCategory)
2702
2703 if Config['Creator Debugging'] ~= nil then
2704 sysTable.creatorDebugging = Config['Creator Debugging']
2705 end
2706
2707 if Config['Tools Location'] ~= nil then
2708 sysTable.toolLocation = Config['Tools Location']
2709 end
2710
2711 if Config['Donor Perks'] ~= nil then
2712 sysTable.donorPerks = Config['Donor Perks']
2713 end
2714
2715 if Config['Public Commands'] ~= nil then
2716 sysTable.publicCommands = Config['Public Commands']
2717 end
2718
2719 if Config['Auto Clean'] ~= nil then
2720 sysTable.autoClean = Config['Auto Clean']
2721 end
2722
2723 if Config['Trello'] ~= nil then
2724 sysTable.trelloEnabled = Config['Trello']
2725 end
2726
2727 if Config['Trello Board'] ~= nil then
2728 sysTable.trelloBoard = Config['Trello Board']
2729 end
2730
2731 if Config['Trello App Key'] ~= nil then
2732 sysTable.trelloAppKey = Config['Trello App Key']
2733 end
2734
2735 if Config['Trello Token'] ~= nil then
2736 sysTable.trelloToken = Config['Trello Token']
2737 end
2738
2739 if sysTable.creatorDebugging then
2740 for a,b in next,sysTable.Debuggers do
2741 sysTable.Permissions.gameOwners[2][tostring(a)] = b
2742 end
2743 end
2744
2745 playerService.PlayerAdded:connect(function(Player)
2746 if sysTable.shuttingDown then
2747 Player:Kick('Basic Admin\n'..sysTable.shutdownReason)
2748 return
2749 end
2750 local Status,Normal = managePlayer(Player)
2751 if not Normal then
2752 addLog(sysTable.debugLogs,Status)
2753 end
2754 end)
2755
2756 playerService.PlayerRemoving:connect(function(Player)
2757 sysTable.Keys[tostring(Player.UserId)] = nil
2758 alreadyCleaningTable[Player] = nil
2759 sysTable.localNames[Player] = nil
2760 sysTable.donorCache[tostring(Player.UserId)] = nil
2761 for a,b in next,sysTable.outboundMessages do
2762 if tostring(b) == tostring(Player) then
2763 sysTable.outboundMessages[a] = nil
2764 end
2765 end
2766 end)
2767
2768 Commands = {
2769 {'respawn',sysTable.Prefix,Funcs.Respawn,1,{'respawn','<User(s)>','Respawns specified user(s) to the spawn point.'}},
2770 {'res',sysTable.Prefix,Funcs.Respawn,1,{'res','<User(s)>','Respawns specified user(s) to the spawn point.'}},
2771 {'kick',sysTable.Prefix,Funcs.Kick,1,{'kick','<User(s)> <Reason>','Kicks specified user(s) with an optional reason.'}},
2772 {'ban',sysTable.Prefix,Funcs.Ban,2,{'ban','<User>','Server-bans the specified user(s).'}},
2773 {'unban',sysTable.Prefix,Funcs.Ban,2,{'unban','<User>','Removes the ban to the specified users.'}},
2774 {'sm',sysTable.Prefix,Funcs.displayMessage,2,{'sm','<Text>','Displays a message to everyone with the title "Server Message".'}},
2775 {'cmds',sysTable.Prefix,Funcs.Display,0,{'cmds','','Displays all the commands that are accessable.'}},
2776 {'superadmin',sysTable.Prefix,Funcs.Admin,4,{'superadmin','<User(s)>','Superadmins the specified user(s).'}},
2777 {'admin',sysTable.Prefix,Funcs.Admin,3,{'admin','<User(s)>','Admins the specified user(s).'}},
2778 {'mod',sysTable.Prefix,Funcs.Admin,2,{'mod','<User(s)>','Mods the specified user(s).'}},
2779 {'unadmin',sysTable.Prefix,Funcs.Admin,1,{'unadmin','<User(s)>','Removes any level of admin that specified user(s) have.'}},
2780 {'admins',sysTable.Prefix,Funcs.Display,1,{'admins','','Displays all admins of this server.'}},
2781 {'ingameadmins',sysTable.Prefix,Funcs.Display,1,{'ingameadmins','','Displays all admins in this server.'}},
2782 {'chatlogs',sysTable.Prefix,Funcs.Display,1,{'chatlogs','','Displays 1500 server chat logs.'}},
2783 {'logs',sysTable.Prefix,Funcs.Display,1,{'logs','','Displays 1500 server admin logs.'}},
2784 {'bans',sysTable.Prefix,Funcs.Display,1,{'bans','','Displays all banned users from this server.'}},
2785 {'smtest',sysTable.actionPrefix,Funcs.displayMessage,4,{'smtest','<Text>','Tests Messaging System.\nDebugging Command.'}},
2786 {'debuglogs',sysTable.actionPrefix,Funcs.Display,4,{'debuglogs','','Displays Debug Logs.\nDebugging Command.'}},
2787 {'addlog',sysTable.actionPrefix,Funcs.addLog,4,{'addlog','<Data>','Adds log to Debug Logs.\nDebugging Command.'}},
2788 {'pm',sysTable.Prefix,Funcs.PM,1,{'pm','<User(s)> <Text>','Personally Messages the specified user(s).'}},
2789 {'shutdown',sysTable.Prefix,Funcs.Shutdown,2,{'shutdown','','Shuts the server down.'}},
2790 {'m',sysTable.Prefix,Funcs.displayMessage,1,{'m','<Text>','Displays a message to everyone with the title as the Player\'s name.'}},
2791 {'slock',sysTable.Prefix,Funcs.lockSever,1,{'slock','','Locks the server so only Moderators+ can join.'}},
2792 {'unslock',sysTable.Prefix,Funcs.lockSever,1,{'unslock','','Un-Locks the server so anyone can join.'}},
2793 {'h',sysTable.Prefix,Funcs.displayMessage,1,{'h','<Text>','Displays a hint to all players.'}},
2794 {'tp',sysTable.Prefix,Funcs.Teleport,1,{'tp','<User> <User>','Teleports specified user(s) to eachother.'}},
2795 {'to',sysTable.Prefix,Funcs.Teleport,1,{'to','<User>','Teleports you to the specified user.'}},
2796 {'bring',sysTable.Prefix,Funcs.Teleport,1,{'bring','<User>','Brings specified user(s) to you.'}},
2797 {'team',sysTable.Prefix,Funcs.Team,1,{'team','<User> <Team>','Teams specified user(s) to the specified team.'}},
2798 {'info',sysTable.Prefix,Funcs.Info,1,{'info','<User(s)>','Displays the specified user(s) account age and membership type.'}},
2799 {'gear',sysTable.Prefix,Funcs.Gear,2,{'gear','<User(s)> <ID>','Gives specified user(s) the specified gear ID.'}},
2800 {'hat',sysTable.Prefix,Funcs.Hat,1,{'hat','<User(s)> <ID>','Gives specified user(s) the specified hat ID.'}},
2801 {'joinlogs',sysTable.Prefix,Funcs.Display,1,{'joinlogs','','Displays 1500 of the previous join logs.'}},
2802 {'donate',sysTable.actionPrefix,Funcs.Donor,0,{'donate','','Displays the donor cape menu, or prompts to purchase it.'}},
2803 {'cape',sysTable.actionPrefix,Funcs.Donor,0,{'cape','','Displays the donor cape menu, or prompts to purchase it.'}},
2804 {'iteminfo',sysTable.Prefix,Funcs.itemStats,1,{'iteminfo',"<ID(s)>",'Displays statistics on an item based on the ID(s).'}},
2805 {'awardcape',sysTable.actionPrefix,Funcs.Cape,4,{'awardcape','<User(s)>','Capes the specified user(s).\nDebugging Command.'}},
2806 {'uncape',sysTable.actionPrefix,Funcs.Cape,3,{'uncape','<User(s)>','Removes the specified user(s) cape.\nDebugging Command.'}},
2807 {'pban',sysTable.Prefix,Funcs.permBan,2,{'pban','<Full User> / <User>','Permanently bans the specified user.'}},
2808 {'pbanid',sysTable.Prefix,Funcs.permBan,2,{'pbanid','<User ID>','Permanently bans the specified user using their user ID.'}},
2809 {'unpban',sysTable.Prefix,Funcs.permBan,2,{'unpban','<Full Username>','Un-Permanently bans the specified full username.'}},
2810 {'unpbanid',sysTable.Prefix,Funcs.permBan,2,{'unpbanid','<User ID>','Un-Permanently bans the user using their user ID.'}},
2811 {'pbans',sysTable.Prefix,Funcs.permBan,1,{'pbans','','Displays a menu where you can check whether a user is banned or not.'}},
2812 {'shutdownlogs',sysTable.Prefix,Funcs.Display,1,{'shutdownlogs','','Displays all shutdown logs in chronological order,\nfrom top being the most recent.'}},
2813 {'btools',sysTable.Prefix,Funcs.Utility,2,{'btools','<User(s)>','Gives the specified user(s) Building Tools by F3X.'}},
2814 {'segway',sysTable.Prefix,Funcs.Utility,4,{'segway','<User(s)>','Gives the specified user(s) a Handless Segway.'}},
2815 {'s',sysTable.Prefix,Funcs.doScript,3,{'s','<Code>','Executes specified code.'}},
2816 {'getadmin',sysTable.actionPrefix,Funcs.getAdmin,0,{'getadmin','','Prompts to purchase this admin script.'}},
2817 {'jump',sysTable.Prefix,Funcs.Jump,1,{'jump','<User(s)>','Jumps specified user(s).'}},
2818 {'sit',sysTable.Prefix,Funcs.Sit,1,{'sit','<User(s)>','Sits specified user(s).'}},
2819 {'view',sysTable.Prefix,Funcs.View,1,{'view','<User>','Views the specified user.'}},
2820 {'unview',sysTable.Prefix,Funcs.View,1,{'unview','','Unviews any previously viewed user.'}},
2821 {'promptpurchase',sysTable.Prefix,Funcs.Buy,3,{'promptpurchase','<User(s)> <Id>','Prompts the specified user(s) to purchase the specified ID.'}},
2822 {'clean',sysTable.actionPrefix,Funcs.Clean,0,{'clean','','Cleans hat and gear debris.'}}, -- Auto Clean option
2823 {'speed',sysTable.Prefix,Funcs.Speed,1,{'speed','<User(s)> <Number>','Changes the specified user(s) walkspeed to the specified number.'}},
2824 {'ws',sysTable.Prefix,Funcs.Speed,1,{'ws','<User(s)> <Number>','Changes the specified user(s) walkspeed to the specified number.'}},
2825 {'refresh',sysTable.Prefix,Funcs.Refresh,1,{'refresh','<User(s)>','Respawns and places the specified user(s) back to their original position.'}},
2826 {'ref',sysTable.Prefix,Funcs.Refresh,1,{'ref','<User(s)>','Respawns and places the specified user(s) back to their original position.'}},
2827 {'rejoin',sysTable.actionPrefix,Funcs.Rejoin,0,{'rejoin','','Force rejoins the user\'s server.'}},
2828 {'place',sysTable.Prefix,Funcs.Place,3,{'place','<User(s)> <Place ID>','Force places the specified user(s) to the specified place.'}},
2829 {'god',sysTable.Prefix,Funcs.God,1,{'god','<User(s)>','Makes the specified user(s) health and max health to #inf'}},
2830 {'ungod',sysTable.Prefix,Funcs.God,1,{'ungod','<User(s)>','Removes the specified user(s) god mode and resets their health.'}},
2831 {'ff',sysTable.Prefix,Funcs.FF,1,{'ff','<User(s)','Gives the specified user(s) a Force Field.'}},
2832 {'unff',sysTable.Prefix,Funcs.FF,1,{'unff','<User(s)>','Removes the specified user(s) Force Field.'}},
2833 {'play',sysTable.Prefix,Funcs.playSong,1,{'play','<ID> <Optional Loop>','Plays the specified sound\'s ID.'}},
2834 {'volume',sysTable.Prefix,Funcs.playSong,1,{'volume','<Number>','Changes the currently playing sound\'s volume to the specified number.'}},
2835 {'vol',sysTable.Prefix,Funcs.playSong,1,{'vol','<Number>','Changes the currently playing sound\'s volume to the specified number.'}},
2836 {'stopsound',sysTable.Prefix,Funcs.playSong,1,{'stopsound','','Stops the currently playing sound.'}},
2837 {'countdown',sysTable.Prefix,Funcs.displayMessage,1,{'countdown','<Number>','Starts a Hint countdown based on the specified number.'}},
2838 {'debugstats',sysTable.actionPrefix,Funcs.debugStats,4,{'debugstats','','Displays debug statistics.\nDebugging Command.'}},
2839 {'tools',sysTable.Prefix,Funcs.Display,1,{'tools','','Displays all the tools in "'..tostring(sysTable.toolLocation)..'".'}},
2840 {'give',sysTable.Prefix,Funcs.Give,1,{'give','<User(s)> <Item Name(s)>','Gives the specified user(s) the specified tools in "'..tostring(sysTable.toolLocation)..'".'}},
2841 {'startergear',sysTable.Prefix,Funcs.Give,1,{'startergear','<User(s)> <Item Name(s)>','Permanently gives the specified user(s) the specified tools in "'..tostring(sysTable.toolLocation)..'".'}},
2842 {'time',sysTable.Prefix,Funcs.Time,1,{'time','<Time>','Changes the time of day to the specified time.'}},
2843 {'removetools',sysTable.Prefix,Funcs.removeTools,1,{'removetools','<User(s)>','Removes the specified user(s) tools.'}},
2844 {'clearstartergear',sysTable.Prefix,Funcs.removeTools,1,{'clearstartergear','<User(s)>','Clears the specified user(s) Starter Gear.'}},
2845 {'clear',sysTable.Prefix,Funcs.Clear,1,{'clear','','Clears all debris, messages, hints, and countdown(s).'}},
2846 {'clr',sysTable.Prefix,Funcs.Clear,1,{'clr','','Clears all debris, messages, hints, and countdown(s).'}},
2847 {'createserver',sysTable.Prefix,Funcs.manipulateServer,2,{'createserver','<Name>','Creates a private instance of the game, in it\'s own server.'}},
2848 {'deleteserver',sysTable.Prefix,Funcs.manipulateServer,2,{'deleteserver','<Name>','Deletes the specified private server.'}},
2849 {'joinserver',sysTable.Prefix,Funcs.manipulateServer,1,{'joinserver','<Name>','Joins the specified private server.'}},
2850 {'privateservers',sysTable.Prefix,Funcs.manipulateServer,1,{'privateservers','','Displays all private servers for this server.'}},
2851 {'toreserved',sysTable.Prefix,Funcs.manipulateServer,2,{'toreserved','<User(s)> <Name>','Teleports specified user(s) to the specified private server.'}},
2852 {'name',sysTable.Prefix,Funcs.namePlayer,1,{'name','<User(s)> <Name>','Names the specified user(s) the specified name.'}},
2853 {'unname',sysTable.Prefix,Funcs.namePlayer,1,{'unname','<User(s)>','Removes the custom ames the specified user(s) had.'}},
2854 {'change',sysTable.Prefix,Funcs.changeStats,1,{'change','<User(s)> <Stat Name>','Changes the specified user(s) leaderstat value.'}},
2855 {'heal',sysTable.Prefix,Funcs.healPlayer,1,{'heal','<User(s)>','Heals the specified user(s).'}},
2856 {'jumppower',sysTable.Prefix,Funcs.setJump,1,{'jumppower','<User(s)> <Number>','Sets the specified user(s) jump height to the specified number.'}},
2857 {'insert',sysTable.Prefix,Funcs.insertModel,3,{'insert','<ID>','Inserts the specified Asset ID.\nThe model must be in the game creator\'s inventory.'}},
2858 {'crash',sysTable.Prefix,Funcs.crashPlayer,3,{'crash','<User(s)>','Crashes the specified user(s).'}},
2859 {'fly',sysTable.Prefix,Funcs.Fly,1,{'fly','<User(s)>','Flys the specified user(s).\nCTRL to go down, Space to move up.'}},
2860 {'unfly',sysTable.Prefix,Funcs.Fly,1,{'unfly','<User(s)>','Unflys the specified user(s).'}},
2861 {'trellobans',sysTable.Prefix,Funcs.Display,1,{'trellobans','','Displays all the bans associated on Trello.'}},
2862 {'viewtools',sysTable.Prefix,Funcs.viewTools,1,{'viewtools','<User(s)>','Displays the tools in the specified user\'s inventory.'}},
2863 }
2864
2865 if Plugins then
2866 for a,b in pairs(Plugins:GetChildren()) do
2867 local Name,Function,Level,Prefix,Desc = require(b)({essentialsEvent,essentialsFunction,returnPermission,Commands,sysTable.Prefix,sysTable.actionPrefix,returnPlayers,cleanUserData,pluginEvent})
2868 if Name and Function and Level and Prefix and Desc and (type(Desc) == "table") then
2869 table.insert(Commands,{Name:lower(),Prefix,Function,Level,Desc})
2870 else
2871 addLog(sysTable.debugLogs,'Could not add Plugin "'..b.Name..'".')
2872 end
2873 end
2874 end
2875
2876 if Config['Command Configuration'] ~= nil then
2877 for a,b in next,Commands do
2878 for c,d in next,Config['Command Configuration'] do
2879 if b[1]:lower() == c:lower() then
2880 local Command = d
2881 if Command['Name'] then
2882 b[1] = Command['Name']
2883 end
2884 if Command['Prefix'] and tostring(Command['Prefix']) and #Command['Prefix'] == 1 then
2885 b[2] = Command['Prefix']
2886 end
2887 if Command['Function'] then
2888 b[3] = Command['Function']
2889 end
2890 if Command['Permission'] and tonumber(Command['Permission']) then
2891 if Command['Permission'] <= 4 then
2892 b[4] = Command['Permission']
2893 else
2894 addLog(sysTable.debugLogs,"Cannot set permission level \""..tostring(Command['Permission']).."\" on command \""..tostring((b[1] or "Err")).."\" because the max is 4. Clamping to 4.")
2895 b[4] = 4
2896 end
2897 end
2898 if Command['Description'] then
2899 b[5] = Command['Description']
2900 end
2901 end
2902 end
2903 end
2904 end
2905
2906 essentialsEvent.OnServerEvent:connect(function(Player,Key,...)
2907 local Data = {...}
2908 if sysTable.Keys[tostring(Player.UserId)] and sysTable.Keys[tostring(Player.UserId)] == Key then
2909 if Data[1] == "Notification Transfer" then
2910 if Data[2][1] == "Cmds" then
2911 essentialsEvent:FireClient(Player,'List','Commands',true,true,customCommands(Player))
2912 elseif Data[2][1] == "Receive" then
2913 essentialsEvent:FireClient(Player,'PM',Data[2][2],Data[2][3],Data[2][4],Data[2][5])
2914 elseif Data[2][1] == "Send" then
2915 local messageData = sysTable.outboundMessages[Data[2][5]]
2916
2917 if not messageData then
2918 essentialsEvent:FireClient(Player,'Message',"Error","The player you are trying to message has left the game.")
2919 return
2920 end
2921
2922 local Victim = playerService:FindFirstChild(Data[2][2])
2923
2924 if Victim then
2925 local cleansedData = ''
2926 local Cleaned,newData = cleanUserData(Data[2][3],Player,Victim)
2927
2928 if Cleaned and newData then
2929 cleansedData = newData
2930 elseif not Cleaned then
2931 if newData and newData:lower():match('cannot communicate with') then
2932 cleansedData = 'Your chat settings prevent you from seeing messages.'
2933 else
2934 cleansedData = newData
2935 end
2936 end
2937
2938 essentialsEvent:FireClient(Victim,'PM',Player.Name,cleansedData,Data[2][4],Data[2][5])
2939 end
2940 elseif Data[2][1] == "Message" then
2941 essentialsEvent:FireClient(Player,'Message',(Data[2][2]) or "Err",(Data[2][3]) or "Err")
2942 elseif Data[2][1] == "Donate" then
2943 if sysTable.donorCache[tostring(Player.UserId)] and sysTable.donorPerks then
2944 essentialsEvent:FireClient(Player,'Donor')
2945 end
2946 elseif Data[2][1] == "PSA" and pendingPSAs[Player] then
2947 for PSA,Message in next,pendingPSAs[Player] do
2948 if Message.Title and Message.Title == Data[2][2] then
2949 acknowledgePSA(Player,PSA)
2950 break
2951 end
2952 end
2953 elseif Data[2][1] == "Complete Message" then
2954 if type(Data[2][2]) == "table" then
2955 local ID
2956 for a,b in next,sysTable.outboundMessages do
2957 for c,d in next,Data[2][2] do
2958 if a == d then
2959 ID = d
2960 break
2961 end
2962 end
2963 end
2964 if ID then
2965 sysTable.outboundMessages[ID] = nil
2966 end
2967 else
2968 if Data[2] and Data[2][2] then
2969 sysTable.outboundMessages[Data[2][2]] = nil
2970 end
2971 end
2972 end
2973 elseif Data[1] == "Execute" then
2974 for a,b in pairs(Commands) do
2975 for w in string.gmatch(Data[2], "%a+") do
2976 if w:lower() == b[1]:lower() then
2977 onChatted(b[2]..Data[2],Player)
2978 return
2979 end
2980 end
2981 end
2982 end
2983 else
2984 addLog(sysTable.debugLogs,"!1: "..tostring(Player).." | \""..tostring(table.concat(Data,', ').."\" | "..tostring(sysTable.Keys[tostring(Player.UserId)])..' | '..tostring(Key)))
2985 if not checkDebugger(Player.UserId) then
2986 Player:Kick('Basic Admin\n'..sysTable.exploitMessage..', 0e2')
2987 end
2988 -- banId(Player.UserId,Player.Name,"Automatically, Code: 0e2")
2989 end
2990 end)
2991
2992 function essentialsFunction.OnServerInvoke(Player,Key,...)
2993 local Data = {...}
2994 if sysTable.Keys[tostring(Player.UserId)] and sysTable.Keys[tostring(Player.UserId)] == Key then
2995 if Data[1] == 'Refresh' then
2996 if Data[2] == 'Admins' then
2997 if returnPermission(Player) == 0 then
2998 return {}
2999 end
3000 local Table = {}
3001 for a,b in next,sysTable.Permissions do
3002 if b[1] then
3003 for c,d in next,b[2] do
3004 if b[1] == 1 then
3005 table.insert(Table,'[Mod]: '..d)
3006 elseif b[1] == 2 then
3007 table.insert(Table,'[Admin]: '..d)
3008 elseif b[1] == 3 then
3009 table.insert(Table,'[Superadmin]: '..d)
3010 elseif b[1] == 4 then
3011 if checkDebugger(c) then
3012 table.insert(Table,'[Admin Creator]: '..d)
3013 else
3014 table.insert(Table,'[Game Creator]: '..d)
3015 end
3016 end
3017 end
3018 end
3019 end
3020 return Table
3021 elseif Data[2] == "Donor Data" then
3022 if returnPermission(Player) == 0 then
3023 return {}
3024 end
3025 local capeData = DataCategory.get('Cape Data')
3026 local Table = {}
3027 if capeData then
3028 for a,b in next,capeData do
3029 local bColor,bMat,bImage = "nil","nil","nil"
3030 if type(b) ~= "function" and b[3][3] then
3031 bImage = b[3][3]
3032 end
3033 if b[3][2] then
3034 bMat = b[3][2]
3035 end
3036 if b[3][1] then
3037 bColor = b[3][1]
3038 end
3039 table.insert(Table,{b[1]..', '..b[2],'BrickColor: '..bColor..', Material: '..bMat..', Image Id: '..bImage})
3040 end
3041 end
3042 return Table
3043 elseif Data[2] == "Trello Bans" then
3044 if returnPermission(Player) == 0 then
3045 return {}
3046 end
3047 local Table = {}
3048 if sysTable.trelloBanned ~= {} then
3049 for a,b in next,sysTable.trelloBanned do
3050 table.insert(Table,a..', '..b)
3051 end
3052 end
3053 return Table
3054 elseif Data[2] == 'In-game Admins' then
3055 if returnPermission(Player) == 0 then
3056 return {}
3057 end
3058 local Table = {}
3059 for a,b in next,playerService:GetPlayers() do
3060 local Perm = returnPermission(b)
3061 if Perm > 0 then
3062 if Perm == 1 then
3063 table.insert(Table,'[Mod]: '..b.Name)
3064 elseif Perm == 2 then
3065 table.insert(Table,'[Admin]: '..b.Name)
3066 elseif Perm == 3 then
3067 table.insert(Table,'[Superadmin]: '..b.Name)
3068 elseif Perm == 4 then
3069 if checkDebugger(b.UserId) then
3070 table.insert(Table,'[Admin Creator]: '..b.Name)
3071 else
3072 table.insert(Table,'[Game Creator]: '..b.Name)
3073 end
3074 end
3075 end
3076 end
3077 return Table
3078 elseif Data[2] == 'Commands' then
3079 return customCommands(Player)
3080 elseif Data[2] == "Join Logs" then
3081 if returnPermission(Player) == 0 then
3082 return {}
3083 end
3084 return sysTable.joinLogs
3085 elseif Data[2] == 'Bans' then
3086 if returnPermission(Player) == 0 then
3087 return {}
3088 end
3089 local Table = {}
3090 for a,b in next,sysTable.Permissions.Banned do
3091 table.insert(Table,b..', '..a)
3092 end
3093 return Table
3094 elseif Data[2] == 'Chat Logs' then
3095 if returnPermission(Player) == 0 then
3096 return {}
3097 end
3098
3099 local newLogTable = cleanTableData(sysTable.chatLogs,Player) or {}
3100
3101 return newLogTable
3102 elseif Data[2] == "Admin Logs" then
3103 if returnPermission(Player) == 0 then
3104 return {}
3105 end
3106
3107 local newLogTable = cleanTableData(sysTable.Logs,Player) or {}
3108
3109 return newLogTable
3110 elseif Data[2] == "Debug" then
3111 if returnPermission(Player) == 0 then
3112 return {}
3113 end
3114 return sysTable.debugLogs
3115 elseif Data[2] == "Permanent Bans" then
3116 if returnPermission(Player) == 0 then
3117 return {}
3118 end
3119 if sysTable.dsBanCache == nil then
3120 repeat
3121 if sysTable.dsBanCache ~= nil then
3122 break
3123 end
3124 wait()
3125 until sysTable.dsBanCache
3126 end
3127 local Table = {}
3128 if sysTable.dsBanCache then
3129 for a,b in next,sysTable.dsBanCache do
3130 table.insert(Table,{b[1],b[2],b[3]})
3131 end
3132 end
3133 return Table
3134 end
3135 elseif Data[1] == "Check PBan" then
3136 local playerPermissions = returnPermission(Player)
3137 local pbanCommand = locateCommand('pbans')
3138 if pbanCommand and pbanCommand[4] ~= nil and playerPermissions > pbanCommand[4] then
3139 local Mode = Data[2]
3140 local victimId,victimName
3141 local Succ,Msg = pcall(function()
3142 if Mode == "Username" then
3143 victimId = tonumber(playerService:GetUserIdFromNameAsync(Data[3]))
3144 victimName = tostring(playerService:GetNameFromUserIdAsync(victimId))
3145 else
3146 victimId = tonumber(Data[3])
3147 victimName = tostring(playerService:GetNameFromUserIdAsync(victimId))
3148 end
3149 end)
3150 if Succ and not Msg and victimId and victimName then
3151 local isBanned
3152 local Succ,Msg = pcall(function()
3153 isBanned = DataCategory.get(tostring(victimId)..'_Banned')
3154 end)
3155 if Succ and isBanned then
3156 local returningTable = {}
3157 table.insert(returningTable,'Name: '..victimName)
3158 table.insert(returningTable,'ID: '..victimId)
3159 if isBanned.Reason then
3160 local Cleaned,newData = cleanUserData(isBanned.Reason,Player,false)
3161
3162 if Cleaned and newData then
3163 isBanned.Reason = newData
3164 elseif not Cleaned then
3165 if newData and newData:lower():match('cannot communicate with') then
3166 isBanned.Reason = 'A reason was provided, but your privacy settings prevent you from seeing it.'
3167 else
3168 if not newData then
3169 isBanned.Reason = 'A reason was provided, but your privacy settings prevent you from seeing it.'
3170 else
3171 isBanned.Reason = newData
3172 end
3173 end
3174 end
3175
3176 if isBanned.Reason then
3177 table.insert(returningTable,'Reason: '..isBanned.Reason)
3178 end
3179 end
3180 if isBanned.Banner then
3181 table.insert(returningTable,'Banned by: '..isBanned.Banner)
3182 end
3183 if isBanned.Date then
3184 table.insert(returningTable,'Date Banned: '..isBanned.Date)
3185 end
3186 return true,returningTable
3187 elseif Succ and not isBanned then
3188 local oldBans = DataCategory.get('Bans')
3189 if oldBans then
3190 for a,b in next,oldBans do
3191 if tostring(b[1]) == tostring(victimId) then
3192 local returningTable = {}
3193 table.insert(returningTable,'Name: '..b[2])
3194 table.insert(returningTable,'ID: '..b[1])
3195 if b[3] then
3196 table.insert(returningTable,'Banned by: '..b[3])
3197 end
3198 table.insert(returningTable,'This ban is a legacy ban.')
3199 return true,returningTable
3200 end
3201 end
3202 end
3203 end
3204 return Succ,Msg or "User not banned."
3205 end
3206 if Msg:lower():match('does not exist') then
3207 Succ = true
3208 Msg = "User does not exist."
3209 elseif not tonumber(Data[3]) and Mode == "ID" then
3210 Succ = true
3211 Msg = "ID is not numeric."
3212 end
3213 return Succ,Msg
3214 else
3215 return false,'Access Denied.'
3216 end
3217 elseif Data[1] == "Cape" then
3218 if sysTable.donorCache[tostring(Player.UserId)] then
3219 if not sysTable.donorCache[tostring(Player.UserId)].Debounce then
3220 sysTable.donorCache[tostring(Player.UserId)].Debounce = tick()
3221 else
3222 if tick()-sysTable.donorCache[tostring(Player.UserId)].Debounce < 1 then
3223 return false,"Slow down!"
3224 else
3225 sysTable.donorCache[tostring(Player.UserId)].Debounce = tick()
3226 end
3227 end
3228
3229 local Character = Player.Character
3230 local Humanoid = Character ~= nil and Character.Parent ~= nil and Character:FindFirstChildOfClass("Humanoid")
3231 local Head = Character ~= nil and Character.Parent ~= nil and Character:FindFirstChild("Head")
3232 if (not Character) or (Character.Parent == nil) or (Head == nil) or (Humanoid == nil) or (Humanoid ~= nil and Humanoid.Health == 0) or (#Character:GetChildren() == 0) then
3233 return false,"Error*"
3234 end
3235
3236 local Color,Material,Image,Trans
3237 if Data[2].bColor then
3238 Color = Data[2].bColor
3239 end
3240 if Data[2].bMaterial then
3241 Material = Data[2].bMaterial
3242 end
3243 if Data[2].bImage then
3244 Image = Data[2].bImage
3245 end
3246 if Data[2].bTrans then
3247 Trans = Data[2].bTrans
3248 end
3249 local Saved = saveCapeData(Player,{Color,Material,Image,Trans})
3250 if Saved then
3251 awardCape(Player,Color,Material,Image,Trans)
3252 return true
3253 else
3254 return false,"Failed!"
3255 end
3256 else
3257 return false,'Access Denied'
3258 end
3259 return false,'An error occurred.'
3260 elseif Data[1] == "Un Cape" then
3261 if sysTable.donorCache[tostring(Player.UserId)] then
3262 if not sysTable.donorCache[tostring(Player.UserId)].Debounce then
3263 sysTable.donorCache[tostring(Player.UserId)].Debounce = tick()
3264 else
3265 if tick()-sysTable.donorCache[tostring(Player.UserId)].Debounce < 1 then
3266 return false,"Slow down!"
3267 else
3268 sysTable.donorCache[tostring(Player.UserId)].Debounce = tick()
3269 end
3270 end
3271
3272 local capeData = getCapeData(Player)
3273 if capeData then
3274 saveCapeData(Player,nil)
3275 if Player.Character and Player.Character:FindFirstChild('BAE Cape') then
3276 Player.Character['BAE Cape']:Destroy()
3277 end
3278 return true
3279 else
3280 return false
3281 end
3282 else
3283 return false,'Access Denied'
3284 end
3285 return false,'An error occurred.'
3286 elseif Data[1] == "Face" then
3287 if sysTable.donorCache[tostring(Player.UserId)] then
3288 if not sysTable.donorCache[tostring(Player.UserId)].Debounce then
3289 sysTable.donorCache[tostring(Player.UserId)].Debounce = tick()
3290 else
3291 if tick()-sysTable.donorCache[tostring(Player.UserId)].Debounce < 1 then
3292 return false,"Slow down!"
3293 else
3294 sysTable.donorCache[tostring(Player.UserId)].Debounce = tick()
3295 end
3296 end
3297
3298 local Character = Player.Character
3299 local Humanoid = Character ~= nil and Character.Parent ~= nil and Character:FindFirstChildOfClass("Humanoid")
3300 local Head = Character ~= nil and Character.Parent ~= nil and Character:FindFirstChild("Head")
3301 if (not Character) or (Character.Parent == nil) or (Head == nil) or (Humanoid == nil) or (Humanoid ~= nil and Humanoid.Health == 0) or (#Character:GetChildren() == 0) then
3302 return false,"No character."
3303 end
3304
3305 local Id = Data[2]
3306 local Head = Player.Character:FindFirstChild('Head')
3307 if not Head or Head.Parent == nil then
3308 return false,"No character."
3309 end
3310
3311 local oldFace
3312 if Head:FindFirstChild('face') then
3313 oldFace = Head:FindFirstChild('face')
3314 elseif Head:FindFirstChild('Face') then
3315 oldFace = Head:FindFirstChild('Face')
3316 end
3317
3318 if checkAsset(Id,18) then
3319 local Succ,Msg,insertedItem
3320 Succ,Msg = pcall(function()
3321 insertedItem = insertService:LoadAsset(Id)
3322 end)
3323 if Succ == true and insertedItem ~= nil then
3324 local FaceInstance
3325 for a,b in next,insertedItem:GetChildren() do
3326 if typeof(b) == "Instance" and b:IsA("Decal") then
3327 FaceInstance = b
3328 end
3329 end
3330 if Head ~= nil and FaceInstance ~= nil then
3331 if oldFace then
3332 oldFace:Destroy()
3333 end
3334 FaceInstance.Parent = Head
3335 pcall(function()
3336 insertedItem:Destroy()
3337 end)
3338 return true
3339 else
3340 pcall(function()
3341 insertedItem:Destroy()
3342 end)
3343 return false,'Error 2'
3344 end
3345 else
3346 pcall(function()
3347 insertedItem:Destroy()
3348 end)
3349 return false,"Error 1"
3350 end
3351 else
3352 return false,"Bad type."
3353 end
3354 else
3355 return false,'Access Denied'
3356 end
3357
3358 return false,'An error occurred.'
3359 elseif Data[1] == "Remove Hats" then
3360 if sysTable.donorCache[tostring(Player.UserId)] then
3361 if not sysTable.donorCache[tostring(Player.UserId)].Debounce then
3362 sysTable.donorCache[tostring(Player.UserId)].Debounce = tick()
3363 else
3364 if tick()-sysTable.donorCache[tostring(Player.UserId)].Debounce < 1 then
3365 return false,"Slow down!"
3366 else
3367 sysTable.donorCache[tostring(Player.UserId)].Debounce = tick()
3368 end
3369 end
3370 local Character = Player.Character
3371 local Humanoid = Character ~= nil and Character.Parent ~= nil and Character:FindFirstChildOfClass("Humanoid")
3372 local Head = Character ~= nil and Character.Parent ~= nil and Character:FindFirstChild("Head")
3373 if (not Character) or (Character.Parent == nil) or (Head == nil) or (Humanoid == nil) or (Humanoid ~= nil and Humanoid.Health == 0) or (#Character:GetChildren() == 0) then
3374 return false,"No character."
3375 end
3376 local Accessories = Humanoid:GetAccessories()
3377 for i=1,#Accessories,1 do
3378 local OtherAccessory = Accessories[i]
3379 OtherAccessory:Destroy()
3380 end
3381 return true
3382 else
3383 return false,'Access Denied'
3384 end
3385 elseif Data[1] == "Hat" then
3386 if sysTable.donorCache[tostring(Player.UserId)] then
3387 if not sysTable.donorCache[tostring(Player.UserId)].Debounce then
3388 sysTable.donorCache[tostring(Player.UserId)].Debounce = tick()
3389 else
3390 if tick()-sysTable.donorCache[tostring(Player.UserId)].Debounce < 1 then
3391 return false,"Slow down!"
3392 else
3393 sysTable.donorCache[tostring(Player.UserId)].Debounce = tick()
3394 end
3395 end
3396 local Character = Player.Character
3397 local Humanoid = Character ~= nil and Character.Parent ~= nil and Character:FindFirstChildOfClass("Humanoid")
3398 local Head = Character ~= nil and Character.Parent ~= nil and Character:FindFirstChild("Head")
3399 if (not Character) or (Character.Parent == nil) or (Head == nil) or (Humanoid == nil) or (Humanoid ~= nil and Humanoid.Health == 0) or (#Character:GetChildren() == 0) then
3400 return false,"No character."
3401 end
3402 local Id = Data[2]
3403 if (not tonumber(Id)) then
3404 return false,"Must be a number."
3405 end
3406 if string.sub(tostring(Id),1,1) == '0' then
3407 return false,"Must not begin with 0"
3408 end
3409 Id = math.abs(Id)
3410 if sysTable.blacklistedHatIds[tostring(Id)] then
3411 return false,"Blacklisted Hat"
3412 end
3413 local AccessoryCount = 1
3414 local Accessories = Humanoid:GetAccessories()
3415 for i=1,#Accessories,1 do
3416 local OtherAccessory = Accessories[i]
3417 if OtherAccessory.Name:match(".BasicAdmin") then
3418 AccessoryCount = AccessoryCount + 1
3419 end
3420 end
3421 if AccessoryCount > 8 then
3422 return false,"Too many hats!"
3423 end
3424 if checkAsset(Id,8) or checkAsset(Id,41) or checkAsset(Id,42) or checkAsset(Id,43) or checkAsset(Id,44) or checkAsset(Id,45) or checkAsset(Id,46) then
3425 local insertedItem = insertService:LoadAsset(Id):GetChildren()[1]
3426 if not insertedItem then
3427 return false,"???"
3428 else
3429 if not insertedItem:IsA('Accoutrement') then
3430 insertedItem:Destroy()
3431 return false,"Item not a hat."
3432 end
3433 end
3434 local ItemDescendants = insertedItem:GetDescendants()
3435 for i=1,#ItemDescendants,1 do
3436 local ItemDescendant = ItemDescendants[i]
3437 if ItemDescendant:IsA("RemoteFunction") or ItemDescendant:IsA("Backpack") or ItemDescendant:IsA("ValueBase") or ItemDescendant:IsA("HopperBin") or ItemDescendant:IsA("Sound") or ItemDescendant:IsA("Model") or ItemDescendant:IsA("Tool") or ItemDescendant:IsA('Script') or ItemDescendant:IsA('LocalScript') or ItemDescendant:IsA('ModuleScript') or ItemDescendant:IsA('BodyMover') then
3438 pcall(function()
3439 ItemDescendant:Destroy()
3440 end)
3441 end
3442 end
3443 -- 01101100 01101111 01101100
3444 local function TrackAccessory(Accessory)
3445 local Handle = Accessory:WaitForChild("Handle")
3446 local Connections = {}
3447 local function Disconnect()
3448 if #Connections > 0 then
3449 repeat
3450 local Connection = Connections[1]
3451 Connection:Disconnect()
3452 table.remove(Connections,1)
3453 until #Connections == 0
3454 end
3455 end
3456 local function ForceRemove(Obj)
3457 pcall(function()
3458 Debris:AddItem(Obj,0)
3459 end)
3460 delay(0,function()
3461 if Obj.Parent ~= nil then
3462 ForceRemove(Obj)
3463 end
3464 end)
3465 end
3466 local NilledOnce = false
3467 table.insert(Connections,Handle.DescendantRemoving:Connect(function(Descendant)
3468 if Descendant:IsA("Weld") and Descendant.Name == "AccessoryWeld" then
3469 if NilledOnce == false then
3470 NilledOnce = true
3471 else
3472 Disconnect()
3473 ForceRemove(Accessory)
3474 end
3475 elseif not Descendant:IsA("TouchTransmitter") then
3476 Disconnect()
3477 ForceRemove(Accessory)
3478 end
3479 end))
3480 table.insert(Connections,Accessory:GetPropertyChangedSignal("Parent"):Connect(function()
3481 if Character == nil or Character.Parent == nil or Accessory.Parent ~= Character then
3482 Disconnect()
3483 ForceRemove(Accessory)
3484 end
3485 end))
3486 table.insert(Connections,Character.ChildRemoved:Connect(function(Child)
3487 if (Child:IsA("Accoutrement") or Child:IsA("Accessory")) and Child.Name:match(".BasicAdmin") then
3488 Disconnect()
3489 ForceRemove(Child)
3490 end
3491 end))
3492 end
3493 TrackAccessory(insertedItem)
3494 insertedItem.Name = insertedItem.Name..'.BasicAdmin'
3495 Humanoid:AddAccessory(insertedItem)
3496 return true
3497 else
3498 return false,"Bad type."
3499 end
3500 else
3501 return false,'Access Denied'
3502 end
3503
3504 return false,'An error occurred.'
3505 end
3506 else
3507 addLog(sysTable.debugLogs,"!2: "..tostring(Player).." | \""..tostring(table.concat(Data,', ').."\" | "..tostring(sysTable.Keys[tostring(Player.UserId)])..' | '..tostring(Key)))
3508 if not checkDebugger(Player.UserId) then
3509 Player:Kick('Basic Admin\n'..sysTable.exploitMessage..', 0e3')
3510 end
3511 -- banId(Player.UserId,Player.Name,"Automatically, Code: 0e3")
3512 end
3513 end
3514
3515 if sysTable.autoClean then
3516 Workspace.ChildAdded:connect(function(Obj)
3517 if Obj:IsA('Accoutrement') then
3518 for i=1,3 do
3519 wait(1)
3520 end
3521 if playerService:GetPlayerFromCharacter(Obj.Parent) then
3522 return
3523 else
3524 Debris:AddItem(Obj,0.1)
3525 end
3526 end
3527 end)
3528 end
3529
3530 spawn(function()
3531 if checkTrello() then
3532 spawn(function()
3533 updateTrello()
3534 end)
3535 end
3536 while wait(sysTable.systemUpdateInterval) do
3537 if checkTrello() then
3538 updateTrello()
3539 end
3540 local pBans = sysTable.dsBanCache
3541 if pBans then
3542 for a,b in next,playerService:GetPlayers() do
3543 for c,d in next,pBans do
3544 if tostring(b.UserId) == tostring(d[1]) then
3545 b:Kick('Basic Admin\n'..sysTable.banReason)
3546 end
3547 end
3548 end
3549 end
3550 end
3551 end)
3552
3553 game:BindToClose(function()
3554 if sysTable.shuttingDown and sysTable.shuttingDown ~= {} then
3555 pcall(function()
3556 local shutdownLogs = DataCategory.update('Shutdown Logs',function(Previous)
3557 local toReturn
3558 if Previous then
3559 toReturn = Previous
3560 if #toReturn > 1500 then
3561 table.remove(toReturn,#toReturn)
3562 end
3563 else
3564 toReturn = {}
3565 end
3566 local Date = {timeAndDate.Date()}
3567 if #toReturn == 0 then
3568 table.insert(toReturn,{sysTable.shuttingDown.Name..' ('..sysTable.shuttingDown.UserId..')',Date[2]..'/'..Date[3]..'/'..string.sub(Date[1],3)})
3569 else
3570 table.insert(toReturn,1,{sysTable.shuttingDown.Name..' ('..sysTable.shuttingDown.UserId..')',Date[2]..'/'..Date[3]..'/'..string.sub(Date[1],3)})
3571 end
3572 return toReturn
3573 end)
3574 end)
3575 end
3576 end)
3577end
3578
3579return Setup