Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Register Computer
- -- Channels
- local BANK_SERVER = 12
- local REGISTER_COMPUTER = 14
- local IMAGE_SERVER = 17
- local EVENT_MANAGER = 18
- local TURTLESCREEN_COMS = 19
- local CARDREADER = 21
- rednet.open("bottom")
- -- Libs
- -- Code
- function register(user,name)
- newline()
- term.write("sending request to server")
- rednet.send(BANK_SERVER, {type="registeruser", user=user, name=name}, "bank")
- newline()
- term.write("waiting for server confirmation")
- rednet.receive("bank")
- return
- end
- local drive = peripheral.wrap("top")
- function newline()
- local cX,cY = term.getCursorPos()
- term.setCursorPos(1,cY+1)
- end
- while true do
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.lime)
- term.write("Username")
- term.setCursorPos(1,2)
- term.write("> ")
- term.setTextColor(colors.white)
- local input = read()
- term.setTextColor(colors.lime)
- newline()
- term.write("registering account for user "..input)
- local user = drive.getDiskID()
- register(user, input)
- drive.setDiskLabel("SnowCenter - " .. input)
- local filePath = fs.combine(drive.getMountPath(), "bal")
- file = fs.open(filePath, "w")
- file.write("0")
- file.close()
- end
Add Comment
Please, Sign In to add comment