Advertisement
justync7

chtboxspam

Jun 26th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. rednet.open("top")
  2. chat=peripheral.wrap("left")
  3. chat1=peripheral.wrap("bottom")
  4. chat2=peripheral.wrap("right")
  5. chat3=peripheral.wrap("front")
  6. chat4=peripheral.wrap("back")
  7. function split(str, pat)
  8. local t = {}
  9. local fpat = "(.-)" .. pat
  10. local last_end = 1
  11. local s, e, cap = str:find(fpat, 1)
  12. while s do
  13. if s ~= 1 or cap ~= "" then
  14. table.insert(t,cap)
  15. end
  16. last_end = e+1
  17. s, e, cap = str:find(fpat, last_end)
  18. end
  19. if last_end <= #str then
  20. cap = str:sub(last_end)
  21. table.insert(t, cap)
  22. end
  23. return t
  24. end
  25.  
  26. while true do
  27. id, msg = rednet.receive()
  28. msg=split(msg,":")
  29. if msg[1] == "spam" then
  30. chat.say(msg[2])
  31. chat1.say(msg[2])
  32. chat2.say(msg[2])
  33. chat3.say(msg[2])
  34. chat4.say(msg[2])
  35. end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement