SHARE
TWEET

Untitled

a guest Jul 2nd, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top