Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open('right')
- local tRecord={}
- local tBanned={}
- print("ID | Distance | Message")
- print("---+----------+--------")
- while true do
- local tBanned={}
- local id,msg,dist=rednet.receive()
- if not tRecord[id] then
- tRecord[id]={}
- end
- while #tRecord[id]>=4 do
- table.remove(tRecord[id],1)
- end
- tRecord[id][#tRecord[id]+1]=msg
- if tRecord[id][1]==tRecord[id][2] and tRecord[id][1]==tRecord[id][3] and tRecord[id][1]==tRecord[id][4] then
- tBanned[id]=true
- elseif not tBanned[id] then
- id=string.sub(id,1,3) --shorten the id to 3 chars if it is too long
- dist=string.sub(dist,1,9)
- print(id..string.rep(' ',3-#id)..'| '..dist..string.rep(' ',9-#dist)..'| '..msg) --add spaces to fill up the gap
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment