Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ OpenComputers Удалённое управление роботом by serafim
- http://pastebin.com/MY7qcets
- с защитой от угона при помощи авторизации
- программа для планшета или пк !
- требования:
- планшет первого уровня, карта wi-fi
- ]]--
- local comp = require("component")
- local event = require("event")
- local term = require("term")
- local gpu = comp.gpu
- local x_max, y_max = gpu.maxResolution()
- local x_min, y_min = 2, 1
- local full = false
- local port = 123
- if comp.isAvailable("modem") then
- modem = comp.modem
- else
- print("Нет модема !")
- os.exit()
- end
- local function info()
- term.clear()
- print("\n".."\n"..[[
- 1 подключиться
- E разрушить вверх
- R поставить W Space
- F использовать A D
- X поворот на 180 S вниз
- C изменить цвет LShift
- T забрать все вещи
- G выбросить все вещи
- V вкл/выкл редстоун сигнал
- Z уменьшить/увеличить экран
- Q выход
- ]])
- end
- local function link()
- term.clear()
- term.write("Введите pin ")
- io.write(">>")
- modem.broadcast(port,io.read())
- local e = {event.pull(1,'modem_message')}
- if e[6] == "false" then
- term.write("pin не верный !")
- os.sleep(1)
- term.clear()
- link()
- elseif e[6] == "true" then
- term.write("Подключен !")
- else
- term.write("Нет ответа !")
- end
- os.sleep(1)
- end
- modem.open(port)
- link()
- info()
- while true do
- local e = {event.pull('key_down')}
- modem.broadcast(port, e[4])
- term.setCursor(1,1)
- term.clearLine()
- term.write(e[4])
- if e[4] == 44 then
- full = not full
- if full then
- gpu.setResolution(x_min,y_min)
- else
- gpu.setResolution(x_max,y_max)
- info()
- end
- elseif e[4] == 16 then
- gpu.setResolution(x_max,y_max)
- term.write(" Выход")
- os.sleep(1)
- term.clear()
- os.exit()
- elseif e[4] == 2 then
- link()
- info()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement