Advertisement
Scarjit

MEstroage v5

Jul 26th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. g = peripheral.wrap("left")
  2. s = peripheral.wrap('openperipheral_sensor_0')
  3. m1 = peripheral.wrap('me_drive_1')
  4. m2 = peripheral.wrap('me_drive_2')
  5. m3 = peripheral.wrap('me_drive_3')
  6. m4 = peripheral.wrap('me_drive_4')
  7. m5 = peripheral.wrap('me_drive_5')
  8. m6 = peripheral.wrap('me_drive_6')
  9. m7 = peripheral.wrap('me_drive_7')
  10. m8 = peripheral.wrap('me_drive_8')
  11. m9 = peripheral.wrap('me_drive_9')
  12. m10 = peripheral.wrap('me_drive_10')
  13. m11 = peripheral.wrap('me_drive_11')
  14. m12 = peripheral.wrap('me_drive_12')
  15. m13 = peripheral.wrap('me_drive_13')
  16. m14 = peripheral.wrap('me_drive_14')
  17. m15 = peripheral.wrap('me_drive_15')
  18. m16 = peripheral.wrap('me_drive_16')
  19. m17 = peripheral.wrap('me_drive_17')
  20. function getBadPlayer()
  21. Pos = 0
  22. aa = s.getPlayerNames()
  23. for q,w in pairs(aa) do
  24.     print(w)
  25.   t = s.getPlayerData(w)
  26. for i,v in pairs(t) do
  27.   if i == 'position' then
  28.     m = v
  29.     for h,j in pairs(m) do
  30.       if h == 'y' then
  31.         y = j
  32.       elseif h == 'x' then
  33.         x = j
  34.       elseif h == 'z' then
  35.         z = j
  36.       end
  37.     end
  38.   end
  39. end
  40. print("----")
  41. print("Range Y: ",y)
  42. print("Range X: ",x)
  43. print("Range Z: ",z)
  44. print("----")
  45. if (y <= 200 or x <= 200 or z <= 200) then
  46.   print("Warning ",w," is in range")
  47.   g.addText(Pos,40,w.." is in Range",color.red)
  48.   Pos = Pos + 5
  49. end
  50. end
  51. end
  52. function Update()
  53. getTB()
  54. getFB()
  55. Percent = FB/TB*150
  56. g.clear()
  57. g.addIcon(2,0,4361,2)
  58. g.addBox(5,17,10,150,colors.green)
  59. g.addBox(5,17,10,Percent,colors.red)
  60. PercentReal = Percent/150*100
  61. print(PercentReal)
  62. if PercentReal < 10 then
  63. rs.setOutput("top",true)
  64. else
  65. rs.setOutput("top",false)
  66. end
  67. end
  68. function getTB()
  69. TB = m1.getTotalBytes() + m2.getTotalBytes() + m3.getTotalBytes() + m4.getTotalBytes() + m5.getTotalBytes() + m6.getTotalBytes() + m7.getTotalBytes() + m8.getTotalBytes() + m9.getTotalBytes()
  70. TB = TB + m10.getTotalBytes() + m11.getTotalBytes() + m12.getTotalBytes() + m13.getTotalBytes() + m14.getTotalBytes() + m15.getTotalBytes() + m16.getTotalBytes() + m17.getTotalBytes()
  71. end
  72. function getFB()
  73. FB = m1.getFreeBytes() + m2.getFreeBytes() + m3.getFreeBytes() + m4.getFreeBytes() + m5.getFreeBytes() + m6.getFreeBytes() + m7.getFreeBytes() + m8.getFreeBytes() + m9.getFreeBytes()
  74. FB = FB + m10.getFreeBytes() + m11.getFreeBytes() + m12.getFreeBytes() + m13.getFreeBytes() + m14.getFreeBytes() + m15.getFreeBytes() + m16.getFreeBytes() + m17.getFreeBytes()
  75. end
  76. getTB()
  77. getFB()
  78. print(TB," Total Bytes")
  79. print(TB/1000," Total KiloBytes")
  80. print(TB/1000000," Total MegaBytes")
  81. print(TB/1000000000," Total GigaBytes")
  82. print(FB," Free Bytes")
  83. print(FB/1000," Free KiloBytes")
  84. print(FB/1000000," Free MegaBytes")
  85. print(FB/1000000000," Free GigaBytes")
  86. print(FB/TB*100," Percentange of Free Space")
  87. while true do
  88. os.sleep(10)
  89. Update()
  90. getBadPlayer()
  91. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement