os.loadAPI("manualQuarry.lua") os.pullEvent = os.pullEventRaw serverID = 0 filename = "adminsuccess.txt" cost = 160 print("Fuel Level: " .. turtle.getFuelLevel()/20000 .. "%") print("Fuel Amount: " .. turtle.getFuelLevel()) function openPort() rednet.open("left") end function readAdminPassword() local file = fs.open(filename, "r") line = file.readLine() file.close() return line end function conductTransaction(username, password) message = "buy " .. username .. " " .. password .. " " .. cost rednet.send(serverID, message) id, value = rednet.receive(nil, 3) os.sleep(1) return value end function checkCredentials(username, password) message = "search " .. username .. " " .. password rednet.send(serverID, message) id, value = rednet.receive(nil, 3) os.sleep(1) return value end status, err = pcall(function() openPort() end) if not status then turtle.select(1) turtle.equipLeft() status, err = pcall(function() openPort() end) if not status then print("Modem not found in first slot or left hand, stopping") os.shutdown() end end print("Mining Turtle Rental - $" .. cost) print("Please Login to Rent") print("Username: ") username = read() print("Password: ") password = read("*") if username == "admin" and password == readAdminPassword() then os.exit(1) end success = conductTransaction(username, password) if success == nil then print("Transaction Connection to Server Failed") os.sleep(3) os.shutdown() elseif success == "false" then print("Transaction Failed") print("Account Value: " .. checkCredentials(username, password)) os.sleep(5) os.shutdown() else print("Success!") turtle.equipLeft() print("Warning: Stopping the Turtle Will Complete Current Transaction (also the turtle will slightly break if it cannot break certain blocks in area)") manualQuarry.mine() os.shutdown() end