Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local event = require("event")
- local modem = component.modem
- local debug = component.debug
- local port = 222
- modem.open(port)
- local items = {
- ["1"] = 16,
- ["2"] = 32,
- ["3"] = 64,
- }
- while true do
- local e = { event.pull()}
- if e[1] == "modem_message" then
- if e[6] == "STerm->SServer" then
- if e[7] == "How" then
- modem.broadcast(port, "SServer->STerm", "Price", items[e[8]])
- end
- if e[7] == "Buying" then
- modem.broadcast(port, "SServer->SRobot", "DOIT", items[e[8]])
- end
- end
- if e[6] == "SRobot->SServer" then
- if e[7] == "Taken" then
- print("Достаток ресурсов: ", e[8])
- modem.broadcast(port, "SServer->STerm", "Sucsesful")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement