Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local oldPull = os.pullEvent;
- os.pullEvent = os.pullEventRaw;
- whileAsk = true;
- modemSide = "left";
- serverId = 11;
- doorSide = "right";
- if peripheral.getType(modemSide) == "modem" then
- rednet.open(modemSide);
- else
- while whileAsk == true do
- shell.run("clear");
- print("Door offline!");
- print("Connect a Modem on the "..modemSide.." side!");
- sleep(1);
- if peripheral.getType(modemSide) == "modem" then
- whileAsk = false;
- rednet.open(modemSide);
- end;
- end;
- end;
- whileAsk = true;
- while whileAsk == true do
- shell.run("clear");
- write("Username: ");
- user = io.read();
- write("Password: ");
- password = io.read();
- rednet.send(serverId, user);
- sleep(0.5);
- rednet.send(serverId, password);
- id, answer = rednet.receive(3);
- shell.run("clear");
- if answer == "" or answer == nil then
- print("No connection to the server!");
- else
- if id == serverId then
- if answer == "nottrusted" then
- print("This door has no trusted connection with the server!");
- end;
- if answer == "unknownuser" then
- print("Unknown user!");
- end;
- if answer == "wrongpassword" then
- print("Wrong password!");
- end;
- if answer == "noperm" then
- print("No permission to this door!");
- end;
- if answer == "true" then
- print("Correct informations.");
- sleep(0.5);
- shell.run("redset "..doorSide.." true");
- sleep(2.5);
- shell.run("redset "..doorSide.." false");
- end;
- end;
- end;
- sleep(1);
- end;
- os.pullEvent = oldPull;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement