Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- settings = {}
- file = fs.open("settings", "r")
- istrue = true
- i = 0
- while istrue do
- i = i+1
- string1 = file.readLine()
- if string1==nill then
- istrue = false
- break
- end
- string2 = file.readLine()
- settings[i] = string2
- end
- banking = function()
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- term.clear()
- local image = paintutils.loadImage("bank")
- paintutils.drawImage(image, 1, 1)
- term.setCursorPos(16, 8)
- term.write("Please input card")
- while not disk.hasData(settings[1]) do
- os.queueEvent("randomEvent")
- os.pullEvent()
- end
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.white)
- term.clear()
- local image = paintutils.loadImage("bank")
- paintutils.drawImage(image, 1, 1)
- term.setCursorPos(16, 8)
- term.write("Please enter code")
- code = ""
- for i=1, 4 do
- ponies=false
- while not ponies do
- local event, key = os.pullEvent("key")
- if key>1 and key<11 then
- amount = key-1
- ponies = true
- end
- end
- code = code..amount
- paintutils.drawImage(image, 1, 1)
- term.setCursorPos(16, 10)
- term.setBackgroundColor(colors.lightBlue)
- term.write(code)
- end
- shell.run("delete", "disk/temp")
- shell.run("cp", "disk/money", "disk/temp")
- file = fs.open("disk/temp", "r")
- stringcode = file.readLine()
- file.close()
- shell.run("delete", "disk/temp")
- stringcode = string.sub(stringcode, 5, -5)
- file = fs.open("disk/temp", "w")
- file.writeLine(stringcode)
- file.close()
- shell.run("decrypt", "disk/temp", code)
- file = fs.open("disk/temp", "r")
- stringcode = tonumber(file.readLine())
- file.close()
- shell.run("delete", "disk/temp")
- if stringcode == nill then
- return "n"
- else
- stringcode = stringcode + price
- if stringcode < 0 then
- return "n"
- else
- stringcode = math.random(9)..math.random(9)..math.random(9)..math.random(9)..stringcode..math.random(9)..math.random(9)..math.random(9)..math.random(9)
- file = fs.open("disk/temp", "w")
- file.writeLine(stringcode)
- file.close()
- shell.run("crypt", "disk/temp", code, "f")
- shell.run("delete", "disk/money")
- shell.run("cp", "disk/temp", "disk/money")
- shell.run("delete", "disk/temp")
- return "y"
- end
- end
- end
- file = fs.open("money", "a")
- file.close()
- file = fs.open("money", "r")
- money = file.readLine()
- if money==nill then
- money = 0
- else
- money = tonumber(money)
- end
- file.close()
- shell.run("delete", "money")
- price = money
- if banking()=="y" then
- term.setBackgroundColor(colors.white)
- term.clear()
- local image = paintutils.loadImage("bank-ok")
- term.setCursorPos(1,1)
- paintutils.drawImage(image, 1, 1)
- os.sleep(1)
- os.reboot()
- else
- term.setBackgroundColor(colors.white)
- term.clear()
- local image = paintutils.loadImage("bank-bad")
- term.setCursorPos(1,1)
- paintutils.drawImage(image, 1, 1)
- end
Add Comment
Please, Sign In to add comment