-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainModule.lua
More file actions
4196 lines (3822 loc) · 138 KB
/
MainModule.lua
File metadata and controls
4196 lines (3822 loc) · 138 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
██████╗░░█████╗░ ██████╗░███████╗███╗░░░███╗░█████╗░██████╗░███████╗
██╔══██╗██╔══██╗ ██╔══██╗██╔════╝████╗░████║██╔══██╗██╔══██╗██╔════╝
██████╦╝███████║ ██████╔╝█████╗░░██╔████╔██║███████║██║░░██║█████╗░░
██╔══██╗██╔══██║ ██╔══██╗██╔══╝░░██║╚██╔╝██║██╔══██║██║░░██║██╔══╝░░
██████╦╝██║░░██║ ██║░░██║███████╗██║░╚═╝░██║██║░░██║██████╔╝███████╗
╚═════╝░╚═╝░░╚═╝ ╚═╝░░╚═╝╚══════╝╚═╝░░░░░╚═╝╚═╝░░╚═╝╚═════╝░╚══════╝
!! We do not support Configured Modules, configure at your own risk !!
Anything that is not directly creddited by anyone in specific was
created by TheFurryFish, otherwise it was created by their respective
owners.
Do not redistribute without proper
credits to the actual creators
--]]
local Components = script:WaitForChild('Components')
local clientCode = Components:WaitForChild('Essentials Code')
local essentialsUI = Components:WaitForChild('Essentials Client')
local Workspace = game:GetService('Workspace')
local Lighting = game:GetService('Lighting')
local playerService = game:GetService('Players')
local replicatedFirst = game:GetService('ReplicatedFirst')
local replicatedStorage = game:GetService('ReplicatedStorage')
local serverScript = game:GetService('ServerScriptService')
local serverStorage = game:GetService('ServerStorage')
local starterGui = game:GetService('StarterGui')
local starterPack = game:GetService('StarterPack')
local testService = game:GetService('TestService')
local starterPlayer = game:GetService('StarterPlayer')
local runService = game:GetService('RunService')
local Teams = game:GetService('Teams')
local Market = game:GetService('MarketplaceService')
local insertService = game:GetService('InsertService')
local userInput = game:GetService('UserInputService')
local teleportService = game:GetService('TeleportService')
local Debris = game:GetService('Debris')
local chatService = game:GetService('Chat')
local httpService = game:GetService('HttpService')
local tweenService = game:GetService('TweenService')
local textService = game:GetService('TextService')
local groupService = game:GetService('GroupService')
local soundService = game:GetService("SoundService")
local Settings = require(game.ReplicatedStorage:WaitForChild("ExtraSettings"))
local getPlayers = require(Components:WaitForChild('Get Players'))
local timeAndDate = require(Components:WaitForChild('Time and Date'))
local dataModule = require(Components:WaitForChild('Data Storage'))
local DataCategory
local trelloApi = require(Components:WaitForChild('Trello'))
local loadStringModule = require(Components:WaitForChild('Loadstring'))
local ExtraSettings = require(game.ReplicatedStorage:WaitForChild("ExtraSettings"))
local F3X = Components:WaitForChild('F3X')
local Sword = Components:WaitForChild('Sword')
local Segway = Components:WaitForChild('Handless Segway')
local sysTable = {
adminVersion = "2.1.7",
Cache = {
Username = {},
},
Keys = {},
Debuggers = {
[3572155455] = "Aspect_oi",
[1275376431] = "B00PUP",
},
Permissions = {
gameOwners = {4,{}},
superAdmins = {3,{}},
Admins = {2,{}},
Mods = {1,{}},
Banned = {},
},
chatLogs = {},
Logs = {},
errorLogs = {},
debugLogs = {},
joinLogs = {},
donorCache = {},
donorID = 9761068977, -- Please don't change. This is the only way you can support us, and how the team gets paid.
adminId = 9450692169,
groupConfig = {
{
['Group ID'] = 0,
['Group Rank'] = 0,
['Tolerance Type'] = '>=',
['Admin Level'] = 0,
},
},
serverLocked = false,
PPC = true,
Prefix = ":",
actionPrefix = "!",
kickReason = "You have been kicked from the server.",
banReason = "You have been banned from the game.",
shutdownReason = "This server is shutting down..\nTry joining a different server!",
serverMessage = "Server Message",
exploitMessage = "Basic Admin Essentials\nAn error occurred.",
serverLockReason = "The server is locked.",
donorPerks = true,
creatorDebugging = true,
publicCommands = true,
autoClean = true,
countingDown = false,
trelloEnabled = false,
trelloBoard = nil,
trelloAppKey = nil,
trelloToken = nil,
trelloBanned = {},
toolLocation = serverStorage,
privateServers = {},
systemUpdateInterval = 30,
dataCategory = "BAE_#$DGF",
commandConfirmation = true,
systemColor = Color3.new(31/255,31/255,31/255),
blacklistedHatIds = {
["1055299"] = true,
["140469731"] = true,
},
outboundMessages = {},
localNames = {},
}
local pluginEvent = Instance.new('BindableEvent')
pluginEvent.Name = "Plugin Event"
local Funcs = {}
local tostring,tonumber = tostring,tonumber
Instance.new("RemoteEvent",game.ReplicatedStorage)
local function addLog(Table,Txt)
if #Table == 0 then
table.insert(Table,Txt)
else
table.insert(Table,1,Txt)
end
if #Table > 1500 then
table.remove(Table,#Table)
end
end
local function checkVersion()
local success, result = pcall(function()
return httpService:GetAsync("http://boopup.dev/api/bar/version?version=" ..sysTable.adminVersion)
end)
if success then
local responseData = httpService:JSONDecode(result)
return responseData
else
addLog(sysTable.debugLogs, "Failed to fetch update information: " .. tostring(result))
return false
end
end
local function returnPermission(Player)
local Permission = 0
for a,b in next,sysTable.Permissions do
if b[1] and b[1] > Permission and b[2][tostring(Player.UserId)] then
Permission = b[1]
end
end
return Permission
end
local function returnPerms_ID(ID)
local Permission = 0
for a,b in next,sysTable.Permissions do
if b[1] and b[1] > Permission and b[2][tostring(ID)] then
Permission = b[1]
end
end
return Permission
end
local function checkDebugger(ID)
if sysTable.creatorDebugging then
for a,b in next,sysTable.Debuggers do
if tostring(ID) == tostring(a) then
return true
end
end
end
return false
end
local Commands
local CommandsDictionary = {}
local essentialsFolder
local essentialsEvent
local essentialsFunction
local function returnPlayers(Player,Arg,Command)
local toReturn,toConfirm = getPlayers(Player,Arg,returnPermission,sysTable.commandConfirmation,Command)
local newConfirming
if toReturn and type(toReturn) == "string" and toReturn == "Confirm" and toConfirm then
for a,b in next,toConfirm do
if not newConfirming then
newConfirming = b[1]
else
newConfirming = newConfirming..', '..b[1]
end
end
local Reply = essentialsFunction:InvokeClient(Player,'Command Confirmation',Command,newConfirming)
if Reply == true then
addLog(sysTable.Logs,{Sender = Player,Bypass = true,Data = 'Confirmed "'..Command..' '..newConfirming..'"'})
return getPlayers(Player,Arg,returnPermission,false,Command)
else
addLog(sysTable.Logs,{Sender = Player,Bypass = true,Data = 'Cancelled "'..Command..' '..newConfirming..'"'})
return {}
end
else
return toReturn
end
end
function Funcs.Respawn(Args)
local Player = Args[1]
local Victims = returnPlayers(Player,Args[3],Args[2])
if not Victims then
return
end
for a,b in next,Victims do
b:LoadCharacter()
runService.Heartbeat:wait()
end
end
local forceNewFilterAPI = false
local IN_GAME_CHAT_USE_NEW_FILTER_API
do
local textServiceExists = (game:GetService("TextService") ~= nil)
local success, enabled = pcall(function() return UserSettings():IsUserFeatureEnabled("UserInGameChatUseNewFilterAPIV2") end)
local flagEnabled = (success and enabled)
IN_GAME_CHAT_USE_NEW_FILTER_API = (forceNewFilterAPI or flagEnabled) and textServiceExists
end
local function Filter(Data,Sender,Receiver,Retries,retryTime)
local Filtered,rawFilterData,Succ,Msg
local Tries = 0
repeat
local secondMessage,secondSucc
Succ,Msg = pcall(function()
if IN_GAME_CHAT_USE_NEW_FILTER_API then
if Receiver == nil then
Receiver = Sender
end
rawFilterData = textService:FilterStringAsync(Data,Sender.UserId)
if Receiver == false then
Filtered = rawFilterData:GetNonChatStringForBroadcastAsync()
else
secondSucc,secondMessage = pcall(function()
if Receiver == false then
Filtered = rawFilterData:GetNonChatStringForBroadcastAsync()
else
Filtered = rawFilterData:GetNonChatStringForUserAsync(Receiver.UserId)
end
end)
end
else
if Receiver == false then
Filtered = chatService:FilterStringForBroadcast(Data,Sender)
else
if Receiver == nil then
Receiver = Sender
end
Filtered = chatService:FilterStringAsync(Data,Sender,Receiver)
end
end
end)
if not Msg and secondMessage then
Msg = secondMessage
end
if Succ == true and secondSucc == false then
Succ = secondSucc
end
if (Retries ~= nil and Retries > 0 and Tries <= Retries) and not Succ then
if Receiver:IsDescendantOf(playerService) and Sender:IsDescendantOf(playerService) then
Tries = Tries + 1
wait((retryTime or 0.25))
else
break
end
else
break
end
until Succ
return Succ,Filtered,rawFilterData,Msg
end
local function cleanUserData(Data,Sender,Receiver)
local returningString,returningData
if Receiver == nil then
Receiver = Sender
end
if Sender ~= nil and Sender:IsA('Player') then
local senderCanChat = chatService:CanUserChatAsync(Sender.UserId)
if senderCanChat then
if Receiver ~= nil and Receiver ~= Sender and Receiver then
if Receiver:IsDescendantOf(playerService) and Sender:IsDescendantOf(playerService) then
local canChatWith
local Succ,Msg = pcall(function()
canChatWith = chatService:CanUsersChatAsync(Sender.UserId,Receiver.UserId)
end)
if not Succ then
addLog(sysTable.debugLogs,'[1] Chat Error: '..tostring(Succ or "nil")..', '..tostring(Msg or "nil"))
return false,'!Filter Error: '..tostring(Msg or "nil")
else
if not canChatWith then
return false,Sender.Name..' cannot communicate with '..Receiver.Name
end
end
end
end
local Succ,Result,rawResult,Msg = Filter(Data,Sender,Receiver,3,0.5)
if not Succ and Msg then
addLog(sysTable.debugLogs,'[2] Chat Error: '..tostring(Succ or "nil")..', '..tostring(Msg or "nil"))
return false,'!Filter Error: '..tostring(Msg or "nil")
elseif Succ then
returningString = Result
returningData = rawResult
end
else
return false
end
end
return returningString ~= nil,returningString,returningData
end
function Funcs.Kick(Args)
local Player = Args[1]
local playerPermissions = returnPermission(Player)
if Args[3] then
local Reason = sysTable.kickReason
if Args[4] then
local combinedArgs = ""
for a,b in pairs(Args) do
if a > 3 then
combinedArgs = combinedArgs..b..' '
end
end
if combinedArgs ~= "" then
Reason = combinedArgs
end
end
local Victims = returnPlayers(Player,Args[3],Args[2])
if not Victims then return end
for a,b in next,Victims do
local victimPermissions = returnPermission(b)
if playerPermissions > victimPermissions then
pluginEvent:Fire("Kick Logs",{Player,"Kicked "..b.Name})
if Reason ~= sysTable.kickReason then
local Cleaned,newData = cleanUserData(Reason,Player,b)
if Cleaned and newData then
Reason = newData
elseif not Cleaned then
if newData and newData:lower():match('cannot communicate with') then
Reason = sysTable.kickReason..'\nA reason was provided, but your privacy settings prevent you from seeing it.'
else
Reason = newData or sysTable.kickReason
end
end
end
b:Kick('Basic Admin Remade. \n You have been kicked for: '..Reason..' Please make sure to avoid these actions!\nModerator: '..Player.Name..'')
end
end
end
end
function Funcs.Ban(Args)
local Reason = Args[4]
local Player = Args[1]
local playerPermissions = returnPermission(Player)
local Victims = returnPlayers(Player,Args[3],Args[2])
local Command = Args[2]
if not Args[3] then return end
if Command == "unban" then
for a,b in next,sysTable.Permissions.Banned do
if string.sub(b:lower(),1,#Args[3]) == Args[3] then
sysTable.Permissions.Banned[tostring(a)] = nil
end
end
elseif Command == "ban" then
if not Victims then
essentialsEvent:FireClient(Player,'Hint','Error',(Args[3] or 'nil')..' was not found.')
return
end
for a,b in next,Victims do
local victimPermissions = returnPermission(b)
if not sysTable.Permissions.Banned[tostring(b.UserId)] and victimPermissions < playerPermissions then
sysTable.Permissions.Banned[tostring(b.UserId)] = b.Name
game.ReplicatedStorage.RemoteEvent:FireAllClients('Success','Successfully banned '..b.name,3)
--pluginEvent:Fire("Ban Logs",{Player,"Banned "..b.Name})
b:Kick('Basic Admin Remade. \n You have been banned for: '..Reason..' . Please make sure to avoid these actions!. Moderator: '..Player.Name..'')
end
end
end
end
local function customCommands(Player)
local Permissions = returnPermission(Player)
local allowedCommands = {}
for a,b in next,Commands do
if b[4] <= Permissions then
if b[3] ~= nil then
if b[3] == Funcs.Donor and sysTable.donorPerks and not (b[3] == Funcs.Donor and not sysTable.donorPerks) then
table.insert(allowedCommands,b)
elseif not (b[3] == Funcs.Donor and not sysTable.donorPerks) then
table.insert(allowedCommands,b)
end
end
end
end
return allowedCommands
end
local function httpCheck()
local Success,Fail = pcall(function()
local Huh = httpService:GetAsync('http://google.com')
end)
if Success and not Fail then
return true
else
return false
end
end
local function checkTrello()
if (sysTable.trelloEnabled == true and sysTable.trelloBoard ~= nil and (httpCheck())) then
return true
else
return false
end
end
local alreadyCleaningTable = {}
local function cleanTableData(Table,toPlayer)
local newLogTable = {}
local senderCanChat = chatService:CanUserChatAsync(toPlayer.UserId)
local uniqueLoop = httpService:GenerateGUID(false)
alreadyCleaningTable[toPlayer] = uniqueLoop
for _,tableData in next,Table do
if alreadyCleaningTable[toPlayer] ~= uniqueLoop or not toPlayer or not toPlayer:IsDescendantOf(playerService) then
newLogTable = nil
break
end
-- We cannot currently filter properly due to the lack
-- of API features available according to the TextService
-- FilterStringForAsync functionality, such as filtering
-- data for if a sender has left the server, to a receiver
-- in the server currently, so we have to use an alternative
-- route to still maintain the essential feature of chatlogs
-- and logs.
-- In the future, I will add appropriate filtering functionality
-- that is in full compliance with Roblox's filter.
if Table == sysTable.chatLogs or Table == sysTable.Logs then
tableData.Bypass = true
end
local Inserting
if tableData.Sender and tableData.Data then
if not tableData.Bypass then
local Cleaned,newData = cleanUserData(tableData.Data,toPlayer,toPlayer)
if Cleaned and newData then
Inserting = newData
elseif not Cleaned then
Inserting = newData or "(Blocked)"
end
else
if not senderCanChat then
if tableData.Data:lower():match('(super safechat)') and tableData.Tag then
Inserting = tableData.Data
else
Inserting = "(Blocked)"
end
else
Inserting = tableData.Data
end
end
end
Inserting = tostring(tableData.Sender)..': '..Inserting
if Inserting then
table.insert(newLogTable,Inserting)
end
end
return newLogTable
end
local pendingPSAs = {}
local function returnPSAMessage(Player,PSA)
local Returning = {}
if pendingPSAs[Player] and pendingPSAs[Player][PSA] and pendingPSAs[Player][PSA].Title then
Returning = pendingPSAs[Player][PSA]
end
return Returning.Title or nil,Returning.Info or nil
end
local function checkForAcknowledgement(Player,PSA)
local hasAcknowledged = DataCategory.get(Player.UserId..'_PSA.'..PSA)
return hasAcknowledged
end
local function acknowledgePSA(Player,PSA)
local Title,Info = returnPSAMessage(Player,PSA)
if Title and Info then
pendingPSAs[Player][PSA] = nil
essentialsEvent:FireClient(Player,'PM',Title,Info,true)
pcall(function()
DataCategory.set(Player.UserId..'_PSA.'..PSA,true)
end)
end
end
function Funcs.Display(Args)
local Player = Args[1]
local Command = Args[2]
if Command == "cmds" then
local PSA = returnPSAMessage(Player,'all')
essentialsEvent:FireClient(Player,'List','Commands',true,true,customCommands(Player),PSA)
elseif Command == "changelog" then
local Changelog = nil
local ChangelogRequest = checkVersion()
Changelog = ChangelogRequest.changelog
essentialsEvent:FireClient(Player,'PM',"Changelog",Changelog,true)
elseif Command == "about" then
essentialsEvent:FireClient(Player,'PM',"About Basic Admin Remade","Basic Admin Essentials is by TheFurryFish, but Basic Admin Remade is a Remix of it owned by B00PUP and Aspect_oi. \n \n Basic Admin is free to use, forever. It was made to give Groups a simple, clean, and fun Admin to use in their Games. \n \n Basic Admin gets updated when it needs to be updated. You can view our change log by doing !changelog",true)
elseif Command == "trellobans" then
if not checkTrello() then
essentialsEvent:FireClient(Player,'Hint','Woah, woah!','Trello is not configured.')
return
end
local Table = {}
if sysTable.trelloBanned ~= {} then
for a,b in next,sysTable.trelloBanned do
table.insert(Table,a..', '..b)
end
end
essentialsEvent:FireClient(Player,'List','Trello Bans',true,true,Table)
elseif Command == "tools" then
local Table = {}
for a,b in next,sysTable.toolLocation:GetDescendants() do
if (b:IsA('Tool') or b:IsA('HopperBin')) and not playerService:GetPlayerFromCharacter(b.Parent) then
table.insert(Table,b.Name)
end
end
essentialsEvent:FireClient(Player,'List','Tools in '..tostring(sysTable.toolLocation),false,true,Table)
elseif Command == "admins" then
local Table = {}
local Starting = 1
for a,b in next,sysTable.Permissions do
if b[1] then
for c,d in next,b[2] do
if b[1] == 1 then
table.insert(Table,'[Mod]: '..d)
elseif b[1] == 2 then
table.insert(Table,'[Admin]: '..d)
elseif b[1] == 3 then
table.insert(Table,'[Superadmin]: '..d)
elseif b[1] == 4 then
table.insert(Table,'[Game Creator]: '..d)
end
end
end
end
essentialsEvent:FireClient(Player,'List','Admins',true,true,Table)
elseif Command == "ingameadmins" then
local Table = {}
for a,b in next,playerService:GetPlayers() do
local Perm = returnPermission(b)
if Perm > 0 then
if Perm == 1 then
table.insert(Table,'[Mod]: '..b.Name)
elseif Perm == 2 then
table.insert(Table,'[Admin]: '..b.Name)
elseif Perm == 3 then
table.insert(Table,'[Superadmin]: '..b.Name)
elseif Perm == 4 then
if checkDebugger(b.UserId) then
table.insert(Table,'[Admin Creator]: '..b.Name)
else
table.insert(Table,'[Game Creator]: '..b.Name)
end
end
end
end
essentialsEvent:FireClient(Player,'List','In-game Admins',true,true,Table)
elseif Command == "chatlogs" then
local newLogTable = cleanTableData(sysTable.chatLogs,Player)
if newLogTable then
local PSA = returnPSAMessage(Player,'all') or returnPSAMessage(Player,'logs')
essentialsEvent:FireClient(Player,'List','Chat Logs',true,true,newLogTable,PSA)
end
elseif Command == "logs" then
local newLogTable = cleanTableData(sysTable.Logs,Player)
game.ReplicatedStorage.RemoteEvent:FireAllClients('Success','Successfully opened logs',3)
if newLogTable then
local PSA = returnPSAMessage(Player,'all') or returnPSAMessage(Player,'logs')
essentialsEvent:FireClient(Player,'List','Admin Logs',true,true,newLogTable,PSA)
end
elseif Command == "joinlogs" then
essentialsEvent:FireClient(Player,'List','Join Logs',true,true,sysTable.joinLogs)
elseif Command == "pbans" then
local pbanData = sysTable.dsBanCache
local Table = {}
if pbanData then
for a,b in next,pbanData do
table.insert(Table,{b[1],b[2],b[3]})
end
end
essentialsEvent:FireClient(Player,'List','Permanent Bans',true,true,Table)
elseif Command == "shutdownlogs" then
local shutdownData = DataCategory.get('Shutdown Logs')
local Table = {}
if shutdownData then
for a,b in next,shutdownData do
table.insert(Table,b[1]..', '..b[2])
end
end
essentialsEvent:FireClient(Player,'List','Shutdown Logs',false,true,Table)
elseif Command == "bans" then
local Table = {}
for a,b in next,sysTable.Permissions.Banned do
table.insert(Table,b..', '..a)
end
essentialsEvent:FireClient(Player,'List','Bans',true,true,Table)
elseif Command == "debuglogs" then
essentialsEvent:FireClient(Player,'List','Debug',true,true,sysTable.debugLogs)
end
end
function Funcs.displayMessage(Args)
local Player = Args[1]
local Command = Args[2]
local combinedArgs = ""
if Command ~= "smtest" then
if not Args[3] then return end
for a,b in pairs(Args) do
if a > 2 then
combinedArgs = combinedArgs..b..' '
end
end
end
if Command == "sm" then
if combinedArgs ~= "" then
for a,b in next,playerService:GetPlayers() do
local cleansedData = ""
local cannotShow = false
local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
if Cleaned and newData then
cleansedData = newData
elseif not Cleaned then
if newData and newData:lower():match('cannot communicate with') then
cannotShow = true
essentialsEvent:FireClient(b,'Message',sysTable.serverMessage,'Your chat settings prevent you from seeing messages.')
else
if not newData then
essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
return
else
cleansedData = newData
end
end
end
if not cannotShow then
essentialsEvent:FireClient(b,'Message',sysTable.serverMessage,cleansedData)
end
end
end
elseif Command == "countdown" then
if Args[3] and tonumber(Args[3]) then
if not sysTable.countingDown then
sysTable.countingDown = true
spawn(function()
for i=Args[3],0,-1 do
if sysTable.countingDown then
essentialsEvent:FireAllClients('Hint','Countdown',i)
wait(1)
if i == 1 then
sysTable.countingDown = false
-- essentialsEvent:FireAllClients('Hint','Countdown',"BEGIN!")
break
end
else
break
end
end
end)
end
elseif Args[3] and tostring(Args[3]) and Args[3]:lower() == 'off' then
sysTable.countingDown = false
end
elseif Command == "m" then
if combinedArgs ~= "" then
for a,b in next,playerService:GetPlayers() do
local cleansedData = ""
local cannotShow = false
local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
if Cleaned and newData then
cleansedData = newData
elseif not Cleaned then
if newData and newData:lower():match('cannot communicate with') then
cannotShow = true
essentialsEvent:FireClient(b,'Message',sysTable.serverMessage,'Your chat settings prevent you from seeing messages.')
else
if not newData then
essentialsEvent:FireClient(Player,'Message',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
return
else
cleansedData = newData
end
end
end
if not cannotShow then
essentialsEvent:FireClient(b,'Message',Player.Name,cleansedData)
end
end
end
elseif Command == "h" then
if combinedArgs ~= "" then
for a,b in next,playerService:GetPlayers() do
local cleansedData = ""
local cannotShow = false
local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
if Cleaned and newData then
cleansedData = newData
elseif not Cleaned then
if newData and newData:lower():match('cannot communicate with') then
cannotShow = true
essentialsEvent:FireClient(b,'Hint',sysTable.serverMessage,'Your chat settings prevent you from seeing messages.')
else
if not newData then
essentialsEvent:FireClient(Player,'Hint',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
return
else
cleansedData = newData
end
end
end
if not cannotShow then
essentialsEvent:FireClient(b,'Hint',Player.Name,cleansedData)
end
end
end
elseif Command == "globalm" then
if combinedArgs ~= "" then
local newData = table.concat(Args, " ", 3)
local Player = Args[1]
local MessagingService = game:GetService("MessagingService")
MessagingService:PublishAsync("GlobalAnnouncement", {user = Player.Name, msg = newData})
end
elseif Command == "smtest" then
essentialsEvent:FireAllClients('Message',"Server Message",[[We're no strangers to love
You know the rules and so do I (do I)
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
I just wanna tell you how I'm feeling
Gotta make you understand
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
We've known each other for so long
Your heart's been aching, but you're too shy to say it (say it)
Inside, we both know what's been going on (going on)
We know the game and we're gonna play it
And if you ask me how I'm feeling
Don't tell me you're too blind to see
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
We've known each other for so long
Your heart's been aching, but you're too shy to say it (to say it)
Inside, we both know what's been going on (going on)
We know the game and we're gonna play it
I just wanna tell you how I'm feeling
Gotta make you understand
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you]])
end
end
local function unadminPlayer(Player,Victim)
local playerPermission = returnPermission(Player)
local Permission = returnPermission(Victim)
for c,d in next,sysTable.Permissions do
if playerPermission > Permission and d[2] and d[2][tostring(Victim.UserId)] then
essentialsEvent:FireClient(Victim,'Admin Update',nil,nil,nil,customCommands(Player),0)
d[2][tostring(Victim.UserId)] = nil
end
end
end
function Funcs.Admin(Args)
local Player = Args[1]
local Command = Args[2]
if not Args[3] then return end
local playerPermission = returnPermission(Player)
local Victims = returnPlayers(Player,Args[3],Args[2])
if not Victims then return end
if Command == "superadmin" then
for a,b in next,Victims do
if b ~= Player then
local Permission = returnPermission(b)
if not sysTable.Permissions.superAdmins[2][tostring(b.UserId)] and (playerPermission > Permission) then
if Permission ~= 0 then
unadminPlayer(Player,b)
end
sysTable.Permissions.superAdmins[2][tostring(b.UserId)] = b.Name
essentialsEvent:FireClient(b,'Admin Update',"Super Admin",'Click for Commands',{'Cmds'},customCommands(Player),3)
end
end
end
elseif Command == "admin" then
for a,b in next,Victims do
if b ~= Player then
local Permission = returnPermission(b)
if not sysTable.Permissions.Admins[2][tostring(b.UserId)] and (playerPermission > Permission) then
if Permission ~= 0 then
unadminPlayer(Player,b)
end
sysTable.Permissions.Admins[2][tostring(b.UserId)] = b.Name
essentialsEvent:FireClient(b,'Admin Update',"Administrator",'Click for Commands',{'Cmds'},customCommands(Player),2)
end
end
end
elseif Command == "mod" then
for a,b in next,Victims do
if b ~= Player then
local Permission = returnPermission(b)
if not sysTable.Permissions.Mods[2][tostring(b.UserId)] and (playerPermission > Permission) then
if Permission ~= 0 then
unadminPlayer(Player,b)
end
sysTable.Permissions.Mods[2][tostring(b.UserId)] = b.Name
essentialsEvent:FireClient(b,'Admin Update',"Moderator",'Click for Commands',{'Cmds'},customCommands(Player),1)
end
end
end
elseif Command == "unadmin" then
for a,b in next,Victims do
local Permission = returnPermission(b)
for c,d in next,sysTable.Permissions do
if playerPermission > Permission and d[2] and d[2][tostring(b.UserId)] then
essentialsEvent:FireClient(b,'Admin Update',nil,nil,nil,customCommands(Player),0)
d[2][tostring(b.UserId)] = nil
end
end
end
end
end
function Funcs.addLog(Args)
local Player = Args[1]
if Args[3] then
local combinedArgs = ""
for a,b in pairs(Args) do
if a > 2 then
combinedArgs = combinedArgs..b..' '
end
end
if combinedArgs ~= "" then
local cleansedData = ""
local Cleaned,newData = cleanUserData(combinedArgs,Player)
if Cleaned and newData then
cleansedData = newData
elseif not Cleaned then
cleansedData = newData or "An error occurred."
end
addLog(sysTable.debugLogs,'[A] '..cleansedData)
end
end
end
local function generateID()
return httpService:GenerateGUID(false)
end
function Funcs.PM(Args)
local Player = Args[1]
if Args[3] and Args[4] then
local combinedArgs
for a,b in pairs(Args) do
if a > 3 then
if not combinedArgs then
combinedArgs = b
else
combinedArgs = combinedArgs..' '..b
end
end
end
local Victims = returnPlayers(Player,Args[3],Args[2])
if not Victims then return end
for a,b in next,Victims do
local Sending = true
local cleansedData = ""
local Cleaned,newData = cleanUserData(combinedArgs,Player,b)
if Cleaned and newData then
cleansedData = newData
elseif not Cleaned then
if newData and newData:lower():match('cannot communicate with') then
Sending = false
essentialsEvent:FireClient(Player,'Hint','Error','You cannot communicate with '..b.Name..'.')
else
if not newData then
essentialsEvent:FireClient(Player,'Hint',sysTable.serverMessage,'Your chat settings prevent you from sending messages.')
return
else
cleansedData = newData