Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local sides = require("sides")
- local gsm = require("gsm")
- local robot = require("robot")
- local term = require("term")
- local inventory = component.inventory_controller
- local redstone = component.redstone
- term.clear()
- print("Сервер-контроллер запущен.")
- local CONTROLLER_PORT = 988
- local ATM_ADDRESS = "ТУТ НОМЕР БЕСПРОВОДНОЙ КАРТЫ У БАНКОМАТА"
- while true do
- local request = gsm.listen(CONTROLLER_PORT)
- if request[3] == ATM_ADDRESS then
- if request[5] == "deposit" then
- print("Запрос на депозит.")
- local amount = 0
- for i = 1, 27 do
- local status = inventory.suckFromSlot(sides.front, i)
- if status == true then
- local stack = inventory.getStackInInternalSlot()
- if stack.name == "СЮДА ТО ЧТО БУДЕТ МОНЕТАМИ" then
- amount = amount + stack.size
- end
- robot.turnLeft()
- inventory.dropIntoSlot(sides.front, 1)
- for j = 1, stack.size do
- redstone.setOutput(sides.front, 1)
- redstone.setOutput(sides.front, 0)
- end
- robot.turnRight()
- end
- end
- gsm.send(request[3], request[4], tostring(amount))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement