Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- badWords = {} -- The list of bad words.
- banned = {}
- -- Add 1 bad word.
- function addBadWord(word)
- badWords[word] = 0
- end
- -- Add a list of bad words.
- function addBadWordList(...)
- for i, w in ipairs(arg) do
- addBadWord(w)
- end
- end
- -- Return if a word is bad or not.
- function isBadWord(word)
- if badWords[word] then
- return true
- end
- return false
- end
- addBadWord("stupid")
- addBadWordList("fart", "lame")
- function eventChatMessage(playerName, message)
- for word in message:gmatch('[^%s]+') do
- if isBadWord(word:lower()) then
- print(playerName.." said a bad word!")
- banned[playerName] = true
- end
- end
- end
- function eventLoop()
- for k,v in pairs(banned) do
- if v then
- tfm.exec.killPlayer(k)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement