Tomoli75

Not CraftFlare

May 5th, 2018
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. rednet.open('right')
  2. local tRecord={}
  3. local tBanned={}
  4. print("ID | Distance | Message")
  5. print("---+----------+--------")
  6. while true do
  7. local tBanned={}
  8. local id,msg,dist=rednet.receive()
  9. if not tRecord[id] then
  10. tRecord[id]={}
  11. end
  12. while #tRecord[id]>=4 do
  13. table.remove(tRecord[id],1)
  14. end
  15. tRecord[id][#tRecord[id]+1]=msg
  16. if tRecord[id][1]==tRecord[id][2] and tRecord[id][1]==tRecord[id][3] and tRecord[id][1]==tRecord[id][4] then
  17. tBanned[id]=true
  18. elseif not tBanned[id] then
  19. id=string.sub(id,1,3) --shorten the id to 3 chars if it is too long
  20. dist=string.sub(dist,1,9)
  21. print(id..string.rep(' ',3-#id)..'| '..dist..string.rep(' ',9-#dist)..'| '..msg) --add spaces to fill up the gap
  22. end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment