Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local LastUpdateTime = "April 19, 2016";
- local Protocol = "CCCS Login";
- local Domain = "SystematicLoop.net/CCCS Server";
- local function open()
- local bOpen, sFreeSide = false, nil
- for n,sSide in pairs(rs.getSides()) do
- if peripheral.getType( sSide ) == "modem" then
- sFreeSide = sSide
- if rednet.isOpen( sSide ) then
- bOpen = true
- break
- end
- end
- end
- if not bOpen then
- if sFreeSide then
- print( "No modem active. Opening "..sFreeSide.." modem" )
- rednet.open( sFreeSide )
- return true
- else
- print( "No modem attached" )
- return false
- end
- end
- return true
- end
- term.clear ();
- term.setCursorPos (1, 1);
- print ("CCCS Client Version 1.1 Loading...");
- print ("Last updated "..LastUpdateTime);
- open ();
- local ServerIP = rednet.lookup (Protocol, Domain);
- if (ServerIP) then
- print ("Found Server with address: "..tostring (ServerIP));
- write ("Username: ");
- local Username = read ();
- print ();
- write ("Password: ");
- local Password = read ("*");
- print ("Validating access...");
- rednet.send (ServerIP, Username, Protocol);
- local SenderID, Message, _ = rednet.receive (Protocol);
- if (SenderID == ServerIP) then
- if (Message == Password) then
- print ("Access Granted!");
- else
- print ("Access Denied!");
- rednet.close ();
- shell.run ("startup");
- end
- end
- else
- print ("A connection to the server could not be established.");
- print ("Check modem connections, weather conditions, address, and try again");
- print ("Program will automatically restart in 10 seconds...");
- sleep (10);
- shell.run ("startup");
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement