Advertisement
Guest User

Untitled

a guest
Jan 17th, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.35 KB | None | 0 0
  1. local a = require('component') local b = require('term') local c = require('event') local d = require('serialization') local e = require('filesystem') local f = require('computer') local g = '/multiradar/'
  2. local h = a.gpu;
  3. local i, j = h.getResolution() local k, l = 30, 24;
  4. local m = {
  5. players = {},
  6. chatPower = false,
  7. userScriptIsOn = false
  8. }
  9. local n = true;
  10. local o = {
  11. frame = 0xFFFFFF,
  12. red = 0xFFFFFF,
  13. gray = 0xFFFFFF,
  14. white = 0xFFFFFF,
  15. background = 0x000000,
  16. text = 0xFFFFFF
  17. }
  18. local p = {
  19. 'CLEAR',
  20. 'ON',
  21. 'OFF',
  22. '[@astek]',
  23. 'x',
  24. '[ ДА ]',
  25. '[ НЕТ ]'
  26. }
  27.  
  28. function gui() screen = 'main'
  29. local q = 4;
  30. h.setResolution(k, l) h.setBackground(o.background) b.clear() h.setForeground(o.text) h.set(5, 2, 'Радаров: Спалились:')
  31. for r in pairs(m.players) do if (r~="atomzerg" and r~="Samuelka" and r~="RelaxManglle" and r~="Stalker_xx7" and r~="astek") then h.set(2, q, '> '..r) q = q + 1 end end;
  32. h.set(5, 22, p[1]) h.set(19, 22, p[2]) h.set(22, 22, p[3]) h.setForeground(o.gray) h.set(1, l, p[4]) h.setForeground(o.frame) h.fill(1, 1, k, 1, '─') h.fill(1, 3, k, 1, '═') h.fill(1, 1, 1, l - 2, '│') h.fill(k, 1, 1, l - 2, '│') h.fill(4, l - 3, l, 1, '═') h.fill(4, l - 1, l, 1, '═') h.set(13, l - 2, 'CHAT:') h.set(1, 1, '┌') h.set(k, 1, '┐') h.set(1, 3, '╞') h.set(k, 3, '╡') h.set(1, l - 2, '└') h.set(2, l - 2, '─') h.set(3, l - 2, '╢') h.set(3, l - 3, '╔') h.set(3, l - 1, '╚') h.set(k, l - 2, '┘') h.set(k - 1, l - 2, '─') h.set(k - 2, l - 2, '╟') h.set(k - 2, l - 3, '╗') h.set(k - 2, l - 1, '╝') h.set(11, l - 2, '│') h.setForeground(o.red) h.set(13, 2, #radars..
  33. ' ') h.set(k, l, p[5]) end;
  34.  
  35. function link(s, t, u) f.beep(1500) h.setForeground(o.red) h.set(t, u, p[s]) os.sleep(0.3) end;
  36.  
  37. function clicker(v, v, w, x) if w == k and x == l then link(5, k, l) n = false elseif w >= 5 and w <= 9 and x == 22 then link(1, 5, 22) m.players = {}
  38. conf_S() gui() elseif w >= 19 and w <= 20 and x == 22 then link(2, 19, 22) m.chatPower = true;
  39. chat('Оповещения в чат включены!') conf_S() gui() elseif w >= 22 and w <= 24 and x == 22 then link(3, 22, 22) chat('Оповещения в чат выключены!') m.chatPower = false;
  40. conf_S() gui() elseif w >= 1 and w <= 21 and x == l then link(4, 1, l) userScript(true) elseif w >= 5 and w <= 10 and x == 14 and screen == 'userScript'
  41. then link(6, 5, 14) m.userScriptIsOn = true;
  42. conf_S() gui() elseif w >= 19 and w <= 25 and x == 14 and screen == 'userScript'
  43. then link(7, 19, 14) m.userScriptIsOn = false;
  44. conf_S() gui() end end;
  45.  
  46. function userScript(gui) if gui then screen = 'userScript'
  47. h.setForeground(o.gray) h.fill(2, 4, 28, 17, ' ') h.set(5, 6, 'Запускает ВАШ скрипт,') h.set(5, 7, 'расположенный в файле') h.set(4, 9, 'при обнаружении нового') h.set(12, 10, 'игрока.') h.setForeground(o.text) h.set(3, 8, g..
  48. 'userscript.lua') h.set(5, 12, 'Активировать функцию?') h.set(5, 14, p[6]) h.set(19, 14, p[7])
  49. else if m.userScriptIsOn then pcall(loadfile(g..
  50. 'userscript.lua')) end end end;
  51.  
  52. function chat(y) if a.isAvailable('chat') and m.chatPower then local z = a.chat;
  53. z.setName('§r§8[§r§4дискорд-astek#❺❸❼❽§r§8] §r§5оу оу отойти подальше ') z.say(y) elseif not a.isAvailable('chat') then h.set(2, l - 4, 'Ошибка: чат бокс не найден!') os.sleep(1) end end;
  54.  
  55. function connect() radars = {}
  56. for A in pairs(a.list('radar')) do table.insert(radars, A) end;
  57. h.setForeground(o.red) h.set(13, 2, #radars..
  58. ' ') end;
  59.  
  60. function connector(v, v, B) if B == 'radar'
  61. then connect() end end;
  62.  
  63. function createDir() e.makeDirectory(g) local C = io.open(g..
  64. 'userscript.lua', 'w') C: flush() C: close() end;
  65.  
  66. function conf_S() local C = io.open(g..
  67. 'config.cfg', 'w') C: write(d.serialize(m, false)) C: flush() C: close() end;
  68.  
  69. function conf_R() local C = io.open(g..
  70. 'config.cfg', 'r') m = d.unserialize(C: read(e.size(g..
  71. 'config.cfg'))) C: close() end;
  72.  
  73. function catched(D) m.players[D] = true;
  74. if (D~="atomzerg" and D~="Samuelka" and D~="astek" and D~="RelaxManglle" and D~="Stalker_xx7" ") then
  75. f.beep(1000) f.beep(1500) userScript(false) conf_S() if a.isAvailable('chat') then chat('§7'..D..
  76. '§r§5 батя пришел ') end end end;
  77.  
  78. function check() if# radars > 0 then
  79. for E = 1, #radars do local check = a.proxy(radars[E]).getPlayers() for F = 1, #check do local D = check[F].name;
  80. if m.players[D] == nil then catched(D) gui() end end end end end;
  81.  
  82. function run() if not e.exists(g) then createDir() conf_S()
  83. else conf_R() end;
  84. c.listen('component_added', connector) c.listen('component_removed', connector) c.listen('touch', clicker) connect() gui() while n do h.setResolution(k, l) pcall(check) os.sleep(0.1) end;
  85. exit() end;
  86.  
  87. function start() if h.maxDepth() <= 0 then f.beep(1500) print('CheckPlayer: Ошибка! Глубина цвета 4 и ниже не поддерживается! Наобходима видеокарта и монитор 3 уровня.')
  88. else run() end end;
  89.  
  90. function exit() conf_S() c.ignore('touch', clicker) c.ignore('component_added', connector) c.ignore('component_removed', connector) b.clear() h.setForeground(o.white) h.setResolution(i, j) end;
  91.  
  92. function c.shouldInterrupt() return false end;
  93. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement