Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. local words = {"swear", "swear", "badword", "another_swear"}
  2. local gold = minetest.get_color_escape_sequence("#ffdf00")
  3. local white = minetest.get_color_escape_sequence("#ffffff")
  4.  
  5. minetest.register_on_chat_message(function(name, message)
  6.  
  7. if not message then
  8. return
  9. end
  10.  
  11. if not minetest.get_player_privs(name).shout then
  12. return true
  13. end
  14.  
  15. local msg = message:lower()
  16.  
  17. for n = 1, #words do
  18.  
  19. if msg:find( words[n] ) then
  20.  
  21. minetest.kick_player(name, "( ** WATCH YOUR LANGUAGE ** )")
  22. minetest.chat_send_all("** " .. name .. " kicked for swearing.")
  23. return true -- do not show message
  24. end
  25. end
  26. message = message:gsub("%s+", " ")
  27. minetest.chat_send_all("<" .. gold .. name .. white .. "> " .. message)
  28. return true
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement