ecco7777

CC Krassometer RF Tools Screen

Jun 24th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.32 KB | None | 0 0
  1. sc=peripheral.wrap("left")
  2. se=peripheral.wrap("right")
  3.  
  4. function scan(s,mode)
  5.     entity={}
  6.     entity.item={}
  7.     entity.mob={}
  8.     entity.player={}
  9.     entity.minecart={}
  10.     entity.itemFrame={}
  11. if mode==nil then
  12. mode="all"
  13. end
  14.  
  15. if mode=="mob" or mode=="all" then
  16. mobs=s.getEntityIds("mob")
  17. for i=1, #mobs do
  18. data=nil
  19. data=s.getEntityData(mobs[i],"mob")
  20. if data~=nil then
  21. entity.mob[#entity.mob+1]=data.all()
  22. else
  23. entity.mob[#entity.mob+1]="lost"
  24. end
  25. end
  26. end
  27.  
  28. if mode=="item" or mode=="all" then
  29. items=s.getEntityIds("item")
  30. for i=1, #items do
  31. data=nil
  32. data=s.getEntityData(items[i],"item")
  33. if data~=nil then
  34. entity.item[#entity.item+1]=data.all()
  35. else
  36. entity.item[#entity.item+1]="lost"
  37. end
  38. end
  39. end
  40.  
  41. if mode=="player" or mode=="all" then
  42. players=s.getPlayers()
  43. for i=1, #players do
  44. data=nil
  45. data=s.getPlayerByName(players[i].name)
  46. if data~=nil then
  47. entity.player[#entity.player+1]=data.all()
  48. inv=entity.player[#entity.player].player.inventory
  49. for i2=1, 40 do
  50. if inv[i2]~=nil then
  51. fp=fs.open("temp","w")
  52. itemp=#entity.player
  53. i2temp=i2
  54. error=true
  55. fp.write("entity.player[itemp].player.inventory[i2temp]=inv[i2temp].all() error=false")
  56. fp.close()
  57. shell.run("temp")
  58. shell.run("rm temp")
  59. if error then
  60. entity.player[itemp].player.inventory[i2temp]=nil
  61. end
  62. end
  63. end
  64. else
  65. entity.player[#entity.player+1]="lost"
  66. end
  67. end
  68. end
  69.  
  70. if mode=="minecart" or mode=="all" then
  71. minecarts=s.getEntityIds("minecart")
  72. for i=1, #minecarts do
  73. data=nil
  74. data=s.getEntityData(minecarts[i],"minecart")
  75. if data~=nil then
  76. entity.minecart[#entity.minecart+1]=data.all()
  77. else
  78. entity.minecart[#entity.minecart+1]="lost"
  79. end
  80. end
  81. end
  82.  
  83. if mode=="frame" or mode=="all" then
  84. itemFrames=s.getEntityIds("item_frame")
  85. for i=1, #itemFrames do
  86. data=nil
  87. data=s.getEntityData(itemFrames[i],"item_frame")
  88. if data~=nil then
  89. entity.itemFrame[#entity.itemFrame+1]=data.all()
  90. else
  91. entity.itemFrame[#entity.itemFrame+1]="lost"
  92. end
  93. end
  94. end
  95.  
  96. return entity
  97. end
  98.  
  99. while true do
  100. scan(se,"player")
  101. for i=1,#entity.player do
  102. sc.clearText(tostring(i))
  103. sc.setText(tostring(i),entity.player[i].name..": ",0xffffff)
  104. krass=#entity.player[i].player.inventory
  105. color=0x00ff00
  106. if entity.player[i].name == "ecco7777" then
  107. krass=500
  108. color=0xff0000
  109. end
  110. for i2=1,krass do
  111. sc.addText(tostring(i),"!",color)
  112. end
  113. end
  114. sleep(1)
  115. end
Add Comment
Please, Sign In to add comment