Advertisement
BINO2002

Untitled

May 3rd, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. -- AdmiralDonut
  2.  
  3. speakers = {"BINO2002,"LIEFMIEJSE44","robbie280"} -- Those who can say the command
  4. banned = {"PointCoded","SavageMunkey","iispecialeffects"} -- Those who are banned
  5.  
  6. function check(name)
  7. print(name)
  8. if #speakers == 0 then print("No speakers") return false end
  9. for i = 1,#speakers do
  10. if string.upper(name) == string.upper(speakers[i]) then return true end
  11. end
  12. return false
  13. end
  14.  
  15. function ban(player, source)
  16. if player ~= nil then
  17. if player ~= source then
  18. player:Remove()
  19. table.insert(banned,player.Name)
  20. end
  21. end
  22. end
  23.  
  24. function unban(player,source)
  25. if player ~= nil then
  26. for i = 1,#banned do
  27. if banned[i]:lower() == player.Name:lower() then
  28. table.remove(banned,i)
  29. end
  30. end
  31. end
  32. end
  33.  
  34. function onChatted(msg, recipient, speaker)
  35. local norm = msg
  36. local msg = string.lower(msg)
  37.  
  38. if not check(speaker.Name) then return end
  39.  
  40. if string.match(msg,"unban") then
  41. local players = game.Players:GetPlayers()
  42. for n = 1, #players do
  43. if string.match(msg,players[n].Name:lower()) then
  44. unban(players[n], speaker)
  45. end
  46. end
  47. return
  48. end
  49.  
  50. if string.match(msg,"ban") then
  51. local players = game.Players:GetPlayers()
  52. for n = 1, #players do
  53. if string.match(msg,players[n].Name:lower()) then
  54. ban(players[n], speaker)
  55. end
  56. end
  57. return
  58. end
  59. end
  60.  
  61. function onPlayerEntered(newPlayer)
  62. print("entered")
  63. newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
  64. for i=1, #banned do
  65. if banned[i]:lower() == newPlayer.Name:lower() then
  66. newPlayer.Parent = nil
  67. end
  68. end
  69. end
  70.  
  71. game.Players.ChildAdded:connect(onPlayerEntered)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement