Advertisement
Guest User

startup

a guest
Aug 1st, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. -- FakeChat SERVER
  2. --
  3. -- Unencrypted, but fun!
  4. -- Spoof chat messages from anyone!
  5. -- Use with responsibility.
  6.  
  7.  
  8. if not commands then
  9.   error("This requires a command computer.")
  10. end
  11.  
  12. local modem = peripheral.find("modem")
  13. if not modem then
  14.   error("A modem is required.")
  15. end
  16. modem.open(1251)
  17. shell.run("cf") --Function for translating messages into something commands.tellraw() can work with
  18.  
  19. local players = { --Add playernames here if you want to filter who receives messages
  20.   "dan200",
  21. }
  22.  
  23. local doFilter = false --If false, filters according to 'players' table
  24.  
  25. local send = function(name,msg)
  26.   local compiled --compiled message, not compiled program
  27.   if msg:sub(1,3) == "___" then
  28.     compiled = msg:sub(4)
  29.   else
  30.     compiled = "<"..name.."&r> "..msg
  31.   end
  32.   compiled = colorFormat(compiled)
  33.   if doFilter then
  34.     for a = 1, #players do
  35.       commands.tellraw(players[a],compiled)
  36.     end
  37.   else
  38.     commands.tellraw("@a",compiled)
  39.   end
  40. end
  41.  
  42. while true do
  43.   local evt = {os.pullEvent("modem_message")}
  44.   if type(evt[5]) == "table" then
  45.     if type(evt[5][1]) == "string" and type(evt[5][2]) == "string" then
  46.       send( evt[5][1], evt[5][2] )
  47.     end
  48.   end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement