Advertisement
yonidrori

Untitled

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