Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local event = require("event")
- local term = require("term")
- local serialization = require("serialization")
- local m = component.modem
- m.setStrength(10000)
- m.open(1)
- function getn(t)
- local count = 0
- for _ in pairs(t) do count = count + 1 end
- return count
- end
- function push_back(l, new_item)
- l[getn(l)+1] = new_item
- end
- local server = "289482dd-8962-4d7a-a662-e545001f4964"
- local input
- local output
- local in2 = { }
- while true do
- input = ""
- in2 = { }
- io.write("type 'help' for list of commands\n\n")
- input = io.read()
- push_back(in2, input)
- if (in2[1] == "change_password") then
- term.clear()
- print("enter username\n")
- input = io.read()
- push_back(in2, input)
- term.clear()
- print("enter old password:\n")
- input = io.read()
- push_back(in2, input)
- term.clear()
- print("enter new password:\n")
- input = io.read()
- push_back(in2, input)
- term.clear()
- elseif (in2[1] == "send") then
- term.clear()
- print("enter your username\n")
- input = io.read()
- push_back(in2, input)
- term.clear()
- print("enter username of person your sending to\n")
- input = io.read()
- push_back(in2, input)
- term.clear()
- print("enter amount you are sending\n")
- input = io.read()
- push_back(in2, input)
- term.clear()
- print("enter password for your account\n")
- input = io.read()
- push_back(in2, input)
- elseif(in2[1] == "balance") then
- term.clear()
- print("enter username\n")
- input = io.read()
- push_back(in2, input)
- term.clear()
- print("enter password\n")
- input = io.read()
- push_back(in2, input)
- elseif(in2[1] == "add_user") then
- term.clear()
- print("enter username\n")
- input = io.read()
- push_back(in2, input)
- term.clear()
- print("enter password\n")
- input = io.read()
- push_back(in2, input)
- term.clear()
- print("enter balance\n")
- input = io.read()
- push_back(in2, input)
- term.clear()
- print("enter admin pass\n")
- input = io.read()
- push_back(in2, input)
- elseif(in2[1] == "list") then
- term.clear()
- print("enter admin pass")
- input = io.read()
- push_back(in2, input)
- elseif(in2[1] == "help") then
- term.clear()
- print("changePassword: Changes account password, duh")
- print("send : Send money from one user to another")
- print("balance : Prints your Balance to screen")
- print("list : Lists All users balance")
- os.sleep(10)
- term.clear()
- end
- if(in2[1] ~= "help") then
- m.send(server, 1, serialization.serialize(in2) )
- local _, _, from, port, distance, message = event.pull(5, "modem_message")
- if(type(distance) ~= "nil") then
- local strength = (distance+1000)
- m.setStrength(strength)
- print(from)
- end
- if( (from == server) and (message ~= "I") and (message ~= "H") ) then
- term.clear()
- output = serialization.unserialize(message)
- print( tostring(output[getn(output)]) )
- os.sleep(10)
- term.clear()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement