Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- itemsArr = { "ecoMobile"}
- pricesArr = { 100}
- shopOwnerAcc = "Doug"
- drive = peripheral.wrap("right")
- serverID = 0
- peripherals = peripheral.getNames()
- periph = true
- index = 1
- while periph do
- periph = peripherals[index]
- if periph then
- periphType = peripheral.getType(periph)
- if periphType == "modem" then
- rednet.open(periph)
- end
- end
- index = index + 1
- end
- info = { ... }
- while true do
- shell.run("clear")
- print("Please enter the name of the app you wish to buy.")
- print("You may also used \"Apps\" instead for a list of items for sale here.")
- option = read()
- if option == "Apps" then
- itemList = true
- index = 0
- shell.run("clear")
- while itemList do
- index = index + 1
- itemList = itemsArr[index]
- if itemList then
- print(itemList)
- os.sleep(1)
- end
- end
- os.sleep(10)
- else
- itemList = true
- index = 0
- shell.run("clear")
- while itemList do
- index = index + 1
- itemList = itemsArr[index]
- if itemList == option then
- myItem = itemsArr[index]
- myPrice = pricesArr[index]
- itemList = false
- end
- end
- print("Item : ".. myItem)
- print("Price: ".. myPrice)
- print("")
- print("Would you like to continue? (y/n)")
- continue = read()
- if continue == "y" then
- info[1] = "Shop"
- shell.run("clear")
- print("Please enter your username.")
- info[2] = read()
- if info[2] then
- print("Please enter your password.")
- info[3] = read('*')
- if info[3] then
- rednet.send(serverID, info, "login")
- id, servInfo, servProtocol = rednet.receive()
- if servProtocol == "success" then
- print("Login successful, transfering money now...")
- info[4] = shopOwnerAcc
- info[5] = myPrice
- rednet.send(serverID, info, "transfer")
- id, servInfo, servProtocol = rednet.receive()
- if servProtocol == "failure" then
- print("Failed to send funds. Reason:")
- print(servInfo[1])
- os.sleep(5)
- else
- print("Successfully transfered all funds, please insert your pocket PC into the disk drive to the right now.")
- while not disk.isPresent("right") do
- sleep(0.1)
- end
- shell.run("clear")
- print("Installing app now...")
- path = disk.getMountPath("right")
- shell.run("copy ".. option.. " ".. path.. "/".. option)
- end
- else
- print("Unable to complete transaction. Reason:")
- print(servInfo)
- end
- else
- print("Please try again and enter a vaild password")
- end
- else
- print("Please try again and enter a vaild username.")
- os.sleep(5)
- end
- else
- print("Action Canceled.")
- os.sleep(5)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement