Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. local isAnAdmin = game.ServerScriptService.RemoteFunctions.AdminChecker.Function
  2. local acceptedCommands = {"kick", "ban", "kill", "f3x", "banish"}
  3.  
  4. function matchPlayer(str)
  5. local result = nil
  6. for _,v in pairs(game.Players:GetPlayers()) do
  7. if (string.find(string.lower(v.Name), str) == 1) then
  8. if (result ~= nil) then return nil end
  9. result = v
  10. end
  11. end
  12. if result == nil then
  13. return nil
  14. else
  15. return result
  16. end
  17. end
  18.  
  19. function getCommand(msg)
  20. if msg:sub(1,1) == "/" or msg:sub(1,1) == ":" then
  21. msg = msg:sub(2,-1):lower()
  22. return msg:split(" ")
  23. end
  24. return {}
  25. end
  26.  
  27. function commandDetect(msg)
  28. for _,v in pairs(acceptedCommands) do
  29. if string.sub(msg,2,string.len(v)+1) == v then
  30. for word in msg:gmatch("%w+") do
  31. if word ~= v then
  32. local match = matchPlayer(word)
  33. return v, match
  34. end
  35. end
  36. return v, nil
  37. end
  38. end
  39. end
  40.  
  41. --[[Admin Commands (older one)
  42. game.Players.PlayerAdded:connect(function(p)
  43. if isAnAdmin:Invoke(p) == true then
  44. print("Enabling admin commands for "..p.Name)
  45. p.Chatted:connect(function(m)
  46. local msg = string.lower(m)
  47. local char = string.sub(msg,1,1)
  48. if char == ":" or char == "/" then
  49. local cmd, plr = commandDetect(msg)
  50. if plr ~= nil and cmd ~= nil then
  51. if cmd == "kick" then
  52. if isAnAdmin:Invoke(plr) ~= true then
  53. plr:Kick()
  54. end
  55.  
  56. elseif cmd == "ban" then
  57. if isAnAdmin:Invoke(plr) ~= true then
  58. game.ServerScriptService.RemoteEventListeners.AdminFunctions.BanRequest:Fire(p,plr)
  59. end
  60. --elseif cmd == "kill" then
  61. -- plr.Character:BreakJoints()
  62. --end
  63. end
  64. end
  65. end)
  66. end
  67. end)]]
  68.  
  69.  
  70. --Admin Commands
  71. game.Players.PlayerAdded:connect(function(p)
  72. if isAnAdmin:Invoke(p) == true then
  73. print("Enabling admin commands for "..p.Name)
  74. p.Chatted:connect(function(msg)
  75. local args = getCommand(msg)
  76.  
  77. if args[1] == "kick" then
  78. local plr = matchPlayer(args[2])
  79. if plr ~= nil then
  80. if isAnAdmin:Invoke(plr) ~= true then
  81. plr:Kick()
  82. end
  83. end
  84.  
  85. elseif args[1] == "ban" then
  86. local plr = matchPlayer(args[2])
  87. if plr ~= nil then
  88. if isAnAdmin:Invoke(plr) ~= true then
  89. game.ServerScriptService.RemoteEventListeners.AdminFunctions.BanRequest:Fire(p,plr)
  90. end
  91. end
  92.  
  93. --[[elseif args[1] == "kill" then
  94. plr.Character:BreakJoints()
  95. ]]
  96. end
  97. end)
  98. end
  99. end)
  100.  
  101. --SuperAdmin Commands
  102. game.Players.PlayerAdded:connect(function(p)
  103. local check1, check2 = isAnAdmin:Invoke(p)
  104. if check1 == true and check2 == true then
  105. print("Enabling super admin commands for "..p.Name)
  106. p.Chatted:connect(function(msg)
  107. local args = getCommand(msg)
  108.  
  109. if args[1] == "f3x" then
  110. local tool = game.ServerStorage.F3X:Clone()
  111. tool.Parent = p.Backpack
  112.  
  113. elseif args[1] == "banish" then
  114. local target = matchPlayer(args[2])
  115. local placeID
  116. if args[3] == "lgbt" then
  117. placeID = 3380011801
  118. elseif args[3] == "furry" then
  119. placeID = 1749851289
  120. else
  121. placeID = tonumber(args[3]) or 1749851289
  122. end
  123. if placeID ~= nil and target ~= nil then
  124. game:GetService("TeleportService"):Teleport(placeID, target)
  125. end
  126.  
  127. end
  128. end)
  129. end
  130. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement