Advertisement
Hachem16

Untitled

Jun 4th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. badWords = {} -- The list of bad words.
  2. banned = {}
  3. -- Add 1 bad word.
  4. function addBadWord(word)
  5. badWords[word] = 0
  6. end
  7.  
  8. -- Add a list of bad words.
  9. function addBadWordList(...)
  10. for i, w in ipairs(arg) do
  11. addBadWord(w)
  12. end
  13. end
  14.  
  15. -- Return if a word is bad or not.
  16. function isBadWord(word)
  17. if badWords[word] then
  18. return true
  19. end
  20. return false
  21. end
  22.  
  23. addBadWord("stupid")
  24. addBadWordList("fart", "lame")
  25.  
  26. function eventChatMessage(playerName, message)
  27. for word in message:gmatch('[^%s]+') do
  28. if isBadWord(word:lower()) then
  29. print(playerName.." said a bad word!")
  30. banned[playerName] = true
  31. end
  32. end
  33. end
  34.  
  35. function eventLoop()
  36. for k,v in pairs(banned) do
  37. if v then
  38. tfm.exec.killPlayer(k)
  39. end
  40. end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement