Advertisement
kanewutt

sfsefesf

May 21st, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. -- charl3s7
  2.  
  3. speakers = {"iiCxnturies","mightyawesome","p0wnz0rd","iiris"} -- Those who can say the command
  4. banned = {"???","???","???"} -- Those who are banned
  5. Kicked = {"???","???","???"} --Those who are kicked
  6.  
  7. function check(name)
  8. print(name)
  9. if #speakers == 0 then print("No speakers") return false end
  10. for i = 1,#speakers do
  11. if string.upper(name) == string.upper(speakers[i]) then return true end
  12. end
  13. return false
  14. end
  15.  
  16. function ban(player, source)
  17. if player ~= nil then
  18. if player ~= source then
  19. player:Remove()
  20. table.insert(banned,player.Name)
  21. end
  22. end
  23. end
  24.  
  25. function make(player, source)
  26. if player ~= nil then
  27. if player ~= source then
  28. table.insert(speakers,player.Name)
  29. end
  30. end
  31. end
  32.  
  33. function kick(player, source)
  34. if player ~= nil then
  35. if player ~= source then
  36. player.Character.Humanoid:Remove()
  37. table.insert(Kicked,player.Name)
  38. end
  39. end
  40. end
  41.  
  42. function unban(player,source)
  43. if player ~= nil then
  44. for i = 1,#banned do
  45. if banned[i]:lower() == player.Name:lower() then
  46. table.remove(banned,i)
  47. end
  48. end
  49. end
  50. end
  51.  
  52. function onChatted(msg, recipient, speaker)
  53. local norm = msg
  54. local msg = string.lower(msg)
  55.  
  56. if not check(speaker.Name) then return end
  57.  
  58. if string.match(msg,"banner") then
  59. local players = game.Players:GetPlayers()
  60. for n = 1, #players do
  61. if string.match(msg,players[n].Name:lower()) then
  62. make(players[n], speaker)
  63. end
  64. end
  65. return
  66. end
  67.  
  68. if string.match(msg,"unban") then
  69. local players = game.Players:GetPlayers()
  70. for n = 1, #players do
  71. if string.match(msg,players[n].Name:lower()) then
  72. unban(players[n], speaker)
  73. end
  74. end
  75. return
  76. end
  77.  
  78. if string.match(msg,"kick") then
  79. local players = game.Players:GetPlayers()
  80. for n = 1, #players do
  81. if string.match(msg,players[n].Name:lower()) then
  82. kick(players[n], speaker)
  83. end
  84. end
  85. return
  86. end
  87.  
  88. if string.match(msg,"ban") then
  89. local players = game.Players:GetPlayers()
  90. for n = 1, #players do
  91. if string.match(msg,players[n].Name:lower()) then
  92. ban(players[n], speaker)
  93. end
  94. end
  95. return
  96. end
  97. end
  98.  
  99. function onPlayerEntered(newPlayer)
  100. print("entered")
  101. newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
  102. for i=1, #banned do
  103. if banned[i]:lower() == newPlayer.Name:lower() then
  104. newPlayer.Parent = nil
  105. end
  106. end
  107. end
  108.  
  109. game.Players.ChildAdded:connect(onPlayerEntered)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement