mrWhiskasss

tps чекер очередной

Jul 19th, 2023
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local c, fs = require("component"), require("filesystem")
  2. local gpu = c.gpu
  3. local TC, RO, RN, RD, TPS = 2, 0, 0, 0
  4.  
  5. gpu.setForeground(0x99b2f2)
  6. gpu.set(1, 2, "TPS Сервера:")
  7. local function time()
  8.     local f = io.open("/tmp/TF", "w")
  9.     f:write("test")
  10.     f:close()
  11.     return(fs.lastModified("/tmp/TF"))
  12. end
  13.  
  14. while true do
  15.     RO = time()
  16.     os.sleep(TC)
  17.     RN = time()
  18.     RD = RN - RO
  19.     TPS = 20000 * TC / RD
  20.     TPS = string.sub(TPS, 1, 5)
  21.     nTPS = tonumber(TPS)
  22.     gpu.set(13, 2, "     ")
  23.     if nTPS <= 10 then
  24.         gpu.setForeground(0xcc4c4c)
  25.     elseif nTPS <= 15 then
  26.         gpu.setForeground(0xf2b233)
  27.     elseif nTPS > 15 then
  28.         gpu.setForeground(0x7fcc19)
  29.     end
  30.     gpu.set(13, 2, TPS)
  31. end
Add Comment
Please, Sign In to add comment