Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- c=require("component")
- cr=require("computer")
- fs=require("filesystem")
- term=require("term")
- event=require("event")
- gpu=c.gpu
- screen=c.screen
- req_list={["openperipheral_bridge"]=1}
- err_c=0
- for v in pairs(req_list) do if not c.isAvailable(v) then req_list[v]=0 err_c=err_c+1 end end
- 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
- player={'SkyDrive_','Firemet','RaydeR_','SoulRedemption','AliceWay','OrdiName','Tumko','LeBron12','Awesome_KeK','Pingwik'}
- brd=c.openperipheral_bridge
- term.clear()
- gpu.setForeground(0xffffff)
- fs.makeDirectory("tmp/bag")
- function getHostTime(timezone)
- timezone = timezone or 2
- local file = io.open("/HostTime.tmp", "w")
- file:write("")
- file:close()
- local timeCorrection = timezone * 3600
- local lastModified = tonumber(string.sub(fs.lastModified("/HostTime.tmp"), 1, -4)) + timeCorrection
- fs.remove("/HostTime.tmp")
- 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)
- return tonumber(day), tonumber(month), tonumber(year), tonumber(hour), tonumber(minute), tonumber(second)
- end
- function real_time()
- local time = {getHostTime(3)}
- local text = string.format("%02d:%02d", time[4], time[5])
- brd.addBox(1,13,65,11,0x000000,0.2)
- brd.addText(4,15,"Время: "..text,0xFFFFFF)
- end
- function tf()
- local f=io.open("/tmp/bag/tps","w")
- f:write("tps")
- f:close()
- return(fs.lastModified("tmp/bag/tps"))
- end
- function tps()
- local c1,c2,c3,tps
- c1=tf()
- os.sleep(2)
- c2=tf()
- c3=c2-c1
- tps=20000*2/c3
- tps=string.sub(tps,1,5)
- brd.addBox(1,1,65,11,0x000000,0.2)
- brd.addText(10,3,"TPS:",0xFFFFFF)
- brd.addText(32,3,tps,0x04CCFF)
- end
- function cn_form(n)
- if n>=10^6 then return string.format("%.2f M",n/10^6)
- elseif n>=10^3 then return string.format("%.2f k",n/10^3)
- else return tostring(n) end
- end
- function skrin()
- local hs_p=30
- brd.addBox(1,hs_p-4,95,11,0x000000,0.2)
- brd.addText(4,28,string.format("Скриншотер - кыш"),0xbbbbbb)
- end
- function plrs()
- local hs_p=57
- brd.addBox(2,hs_p-4,100,14*#player,0x000000,0.2)
- for i=1,#player do
- if cr.addUser(player[i])~=nil then brd.addIcon(3,hs_p-5,"minecraft:skull",3) brd.addText(23,hs_p,player[i],0xbbbbbb)
- else brd.addIcon(3,hs_p-5,"minecraft:skull") brd.addText(23,hs_p,player[i],0x404040) end
- cr.removeUser(player[i])
- hs_p=hs_p+14
- end
- end
- function online()
- brd.addBox(1,40,65,11,0x000000,0.2)
- brd.addText(4,42,string.format("Онлайн:"),0xFFFFFF)
- end
- while true do
- brd.clear()
- online()
- tps()
- real_time()
- plrs()
- skrin()
- brd.sync()
- end
Advertisement
Add Comment
Please, Sign In to add comment