Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- local s = sensor.wrap("top")
- local monitor_ID = 2
- local xMax_mon, yMax_mon = 1, 1
- local name = ""
- local gamer = " Guest"
- text_scale = 2
- function clearScreen(x,y)
- term.clear()
- term.setCursorPos(x,y)
- end
- function getPlayers()
- while true do
- local tg = s.getTargets()
- local tab={}
- for name, det in pairs(tg) do
- if string.find(det.RawName,"player") then
- table.insert(tab,det)
- end
- print(name," ",os.time())
- timer = 0
- gamer = name
- end
- end
- end
- function MonitorSet()
- m = peripheral.wrap("monitor_"..monitor_ID)
- if not m.isColor() then
- clearScreen(1,1)
- error("Golden monitor not found!") -- монитор не золотой.
- end
- m.setTextColor(colors.lime)
- xMax_mon, yMax_mon = m.getSize()
- end
- function PrintCenterMon(str)
- local xPos_mon, yPos_mon = m.getCursorPos()
- str_long = #str
- m.setCursorPos((xMax_mon/2-str_long/2)+1,yPos_mon)
- m.write(str)
- m.setCursorPos(1,yPos_mon+1)
- end
- function main()
- timer = 0
- m.setTextScale(text_scale)
- xMax_mon = xMax_mon*(1/text_scale)
- yMax_mon = yMax_mon*(1/text_scale)
- while true do
- sleep(1)
- timer = timer + 1
- if timer > 5 then
- rs.setOutput("front",true)
- m.clear()
- m.setCursorPos(1, 4)
- PrintCenterMon("1Ridav's Hi-Tech server")
- PrintCenterMon("BANK COMPUTERCRAFT. AlexCC (C)")
- else
- rs.setOutput("front",false)
- m.clear()
- m.setCursorPos(1, 3)
- PrintCenterMon("1Ridav's Hi-Tech server")
- PrintCenterMon("Dear "..gamer.."!")
- PrintCenterMon("WELCOM MAINCRAFT BANK.")
- PrintCenterMon("COMPUTERCRAFT. AlexCC (C)")
- PrintCenterMon("http://computercraft.ru")
- PrintCenterMon("")
- PrintCenterMon("<2014>")
- end
- if timer > 10 then timer = 9 end
- end
- end
- MonitorSet()
- parallel.waitForAll(main, getPlayers)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement