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