Advertisement
Guest User

1

a guest
Nov 19th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.32 KB | None | 0 0
  1.  
  2. local component = require("component")
  3. local colors = require("colors")
  4. local rs = component.redstone
  5. local event = require("event")
  6. local cb = component.chat_box
  7. local nick
  8. local pull_e = require("event").pull
  9. local gpu = component.gpu
  10. local term = require("term")
  11. local pos = "1"
  12. local uti = "1"
  13. local W = 80
  14. local H = 25
  15. local b_color, f_color = gpu.getBackground(), gpu.getForeground()
  16.  
  17. gpu.setResolution(30, 30)
  18.  
  19.  
  20.  
  21.  
  22. local player = {
  23.   [1] = "Jane" ,
  24.   [2] = "Vestalfa",
  25.   [3] = "SkillS",
  26.   [4] = "dmitriy19",
  27.   [5] = "Bro777",
  28.   [6] = "Dmitriy19"
  29.  }
  30.  
  31.  color = {
  32.  green = 0x00ff00,
  33.  yellow = 0xffb600,
  34.  red = 0xff0000,
  35.  cyan = 0x008b8b,
  36.  pink = 0xFF00FF
  37.  }
  38.  term.clear(0)
  39. local n = 1
  40. gpu.setForeground(color.yellow)
  41. print("Created by Jane")
  42. gpu.setForeground(color.cyan)
  43. print("[~]Логи:")
  44. cb.setName("§3Smart§aHouse§7")
  45. rs.setBundledOutput(0, colors.red, 215)
  46. rs.setBundledOutput(0, colors.blue, 215)
  47. function opent(nick)
  48.   rs.setBundledOutput(0, colors.red, 0)
  49.   gpu.setForeground(color.green)
  50.    cb.say(nick..", §2Дверь открыта на 1 секунду ")
  51.    
  52.   os.sleep(1)
  53.   rs.setBundledOutput(0, colors.red, 215)
  54.    cb.say(nick..", §cДверь закрыта")
  55.    gpu.setForeground(color.green)
  56.    print("["..n.."]"..nick.." - Использовал Opent")
  57.    n=n+1
  58.  end
  59.  function open(nick)
  60.   rs.setBundledOutput(0, colors.red, 0)
  61.    cb.say(nick..", §2Дверь открыта")
  62.    gpu.setForeground(color.green)
  63.    print("["..n.."]"..nick.." - использовал Open ")
  64.    pos = "0"
  65.    n=n+1
  66.   rs.setBundledOutput(0, colors.yellow, 215)
  67.    os.sleep(0,2)
  68.    rs.setBundledOutput(0, colors.yellow, 0)
  69.    os.sleep(5)
  70.    rs.setBundledOutput(0, colors.yellow, 215)
  71.    os.sleep(0,2)
  72.    rs.setBundledOutput(0, colors.yellow, 0)
  73.   end
  74.   function openadmin(nick)
  75.   rs.setBundledOutput(0, colors.red, 0)
  76.    pos = "0"
  77.    n=n+1
  78.  end
  79.    function closeadmin(nick)
  80.   rs.setBundledOutput(0, colors.red, 215)
  81.    pos = "1"
  82.    n=n+1
  83.  end
  84.   function close(nick)
  85.   rs.setBundledOutput(0, colors.red, 215)
  86.    cb.say(nick..", §cДверь закрыта")
  87.    gpu.setForeground(color.green)
  88.    print("["..n.."]"..nick.." - использовал Close")
  89.    pos = "1"
  90.    n=n+1
  91.    
  92.  end
  93.    function UE(nick)
  94.   rs.setBundledOutput(0, colors.blue, 215)
  95.    cb.say(nick..", §cУтиль включен")
  96.    gpu.setForeground(color.green)
  97.    print("["..n.."]"..nick.." - включил утилизаторы")
  98.    uti = "1"
  99.    n=n+1
  100.  end
  101.   function UD(nick)
  102.   rs.setBundledOutput(0, colors.blue, 0)
  103.    cb.say(nick..", §2Утиль выключен")
  104.    gpu.setForeground(color.green)
  105.    print("["..n.."]"..nick.." - выключил утилизаторы")
  106.    uti = "0"
  107.    n=n+1
  108.  end
  109.  
  110.  
  111. while true do
  112.  
  113.  e = {event.pull("chat_message")}
  114.   if e[1] == "chat_message" then
  115.    for i = 1, #player do
  116.     if e[3] == player[i] then
  117.     os.sleep(0.1)
  118.      nick = e[3]
  119.    
  120.      if ((e[4] == "open") and ( pos == "1" )) or ((e[4] == "сизам откройся") and ( pos == "1" )) then
  121.       open(nick)
  122.    
  123.      elseif ((e[4] == "open") and ( pos == "0" )) or ((e[4] == "сизам откройся") and ( pos == "0" )) then
  124.       cb.say(nick..", §cДверь уже открыта")
  125.     gpu.setForeground(color.red)
  126.       print("["..n.."]"..nick.." - попытался использовать Open")
  127.       n=n+1
  128.    
  129.     elseif ((e[4] == "close") and ( pos == "0")) or ((e[4] == "сизам закройся") and ( pos == "0")) then
  130.      close(nick)
  131.    
  132.        elseif ((e[4] == "close") and ( pos == "1")) or ((e[4] == "сизам закройся") and ( pos == "1")) then
  133.         cb.say(nick..", §cДверь уже закрыта")
  134.     gpu.setForeground(color.red)
  135.       print("["..n.."]"..nick.." - попытался использовать Сlose")
  136.       n=n+1
  137.  
  138.     elseif ((e[4] == "opent") and ( pos == "1")) then
  139.       opent(nick)
  140.      
  141.        elseif ((e[4] == "opent") and ( pos == "0" )) then
  142.       cb.say(" §cДверь уже открыта")
  143.     gpu.setForeground(color.red)
  144.       print("["..n.."]"..nick.." - попытался использовать Opent")
  145.       n=n+1
  146.  
  147.     elseif ((e[4] == "Выключить утиль") and ( uti == "1" )) then
  148.       cb.say(nick..", §cУтилизаторы выключены.")
  149.       UD(nick)
  150.    
  151.     elseif ((e[4] == "Включить утиль") and ( uti == "0" )) then
  152.     cb.say(" §cУтилизаторы включены.")
  153.       UE(nick)
  154.    
  155.     elseif ((e[4] == "Включить утиль") and ( uti == "1" )) then
  156.       cb.say(nick..", §cУтилизаторы уже включены.")
  157.     gpu.setForeground(color.red)
  158.     print("["..n.."]"..nick.." - попытался включить утилизаторы")
  159.     n=n+1
  160.     elseif ((e[4] == "вырубить утиль") and ( uti == "0" )) then
  161.       cb.say(nick..", §cУтилизаторы уже выключены.")
  162.     gpu.setForeground(color.red)
  163.     print("["..n.."]"..nick.." - попытался выключить утилизаторы")
  164.     n=n+1
  165.   elseif ((e[4] == "openadmin") and ( pos == "1")) then
  166.    openadmin(nick)
  167.    
  168.   elseif ((e[4] == "closeadmin") and ( pos == "0")) then
  169.    closeadmin(nick)
  170.   elseif (string.sub(e[4],1,2) == "##") then
  171.    local a = string.sub(e[4],3)
  172.     gpu.setForeground(color.pink)
  173.    a = string.gsub(a,"&","§")
  174.    print("["..n.."]"..nick.."§2Написал:"..a)
  175.    cb.say(a)
  176.    n=n+1
  177.    break
  178.    
  179.  
  180.  
  181.    
  182.   end
  183.    end
  184.   end
  185. end
  186. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement