CharlyZM

Untitled

Dec 10th, 2022 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. c=require("component")
  2. cr=require("computer")
  3. fs=require("filesystem")
  4. term=require("term")
  5. event=require("event")
  6. gpu=c.gpu
  7. screen=c.screen
  8. req_list={["openperipheral_bridge"]=1}
  9. err_c=0
  10. for v in pairs(req_list) do if not c.isAvailable(v) then req_list[v]=0 err_c=err_c+1 end end
  11. if err_c>0 then term.clear() gpu.setForeground(0xff0000) for v in pairs(req_list) do if req_list[v]==0 then print(v.." is not available") end end gpu.setForeground(0xffffff) os.sleep(0.5) return -1 end
  12. player={'SkyDrive_','Firemet','RaydeR_','SoulRedemption','AliceWay','OrdiName','Tumko','LeBron12','Awesome_KeK','Pingwik'}
  13. brd=c.openperipheral_bridge
  14. term.clear()
  15. gpu.setForeground(0xffffff)
  16. fs.makeDirectory("tmp/bag")
  17.  
  18. function getHostTime(timezone)
  19. timezone = timezone or 2
  20. local file = io.open("/HostTime.tmp", "w")
  21. file:write("")
  22. file:close()
  23. local timeCorrection = timezone * 3600
  24. local lastModified = tonumber(string.sub(fs.lastModified("/HostTime.tmp"), 1, -4)) + timeCorrection
  25. fs.remove("/HostTime.tmp")
  26. local year, month, day, hour, minute, second = os.date("%Y", lastModified), os.date("%m", lastModified), os.date("%d", lastModified), os.date("%H", lastModified), os.date("%M", lastModified), os.date("%S", lastModified)
  27. return tonumber(day), tonumber(month), tonumber(year), tonumber(hour), tonumber(minute), tonumber(second)
  28. end
  29.  
  30. function real_time()
  31. local time = {getHostTime(3)}
  32. local text = string.format("%02d:%02d", time[4], time[5])
  33. brd.addBox(1,13,65,11,0x000000,0.2)
  34. brd.addText(4,15,"Время: "..text,0xFFFFFF)
  35. end
  36.  
  37. function tf()
  38. local f=io.open("/tmp/bag/tps","w")
  39. f:write("tps")
  40. f:close()
  41. return(fs.lastModified("tmp/bag/tps"))
  42. end
  43.  
  44. function tps()
  45. local c1,c2,c3,tps
  46. c1=tf()
  47. os.sleep(2)
  48. c2=tf()
  49. c3=c2-c1
  50. tps=20000*2/c3
  51. tps=string.sub(tps,1,5)
  52. brd.addBox(1,1,65,11,0x000000,0.2)
  53. brd.addText(10,3,"TPS:",0xFFFFFF)
  54. brd.addText(32,3,tps,0x04CCFF)
  55. end
  56.  
  57. function cn_form(n)
  58. if n>=10^6 then return string.format("%.2f M",n/10^6)
  59. elseif n>=10^3 then return string.format("%.2f k",n/10^3)
  60. else return tostring(n) end
  61. end
  62.  
  63.  
  64.  
  65. function skrin()
  66. local hs_p=30
  67. brd.addBox(1,hs_p-4,95,11,0x000000,0.2)
  68. brd.addText(4,28,string.format("Скриншотер - кыш"),0xbbbbbb)
  69. end
  70.  
  71.  
  72.  
  73. function plrs()
  74. local hs_p=57
  75. brd.addBox(2,hs_p-4,100,14*#player,0x000000,0.2)
  76. for i=1,#player do
  77. if cr.addUser(player[i])~=nil then brd.addIcon(3,hs_p-5,"minecraft:skull",3) brd.addText(23,hs_p,player[i],0xbbbbbb)
  78. else brd.addIcon(3,hs_p-5,"minecraft:skull") brd.addText(23,hs_p,player[i],0x404040) end
  79. cr.removeUser(player[i])
  80. hs_p=hs_p+14
  81. end
  82. end
  83.  
  84. function online()
  85. brd.addBox(1,40,65,11,0x000000,0.2)
  86. brd.addText(4,42,string.format("Онлайн:"),0xFFFFFF)
  87. end
  88. while true do
  89.  
  90. brd.clear()
  91. online()
  92. tps()
  93. real_time()
  94. plrs()
  95. skrin()
  96. brd.sync()
  97. end
Advertisement
Add Comment
Please, Sign In to add comment