Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Bank File Please Put In File (bank)--
- -- fff f f ff
- -- f f f f f
- -- f f fff ff f
- -- fff ff fff f f f fff ff f
- -- f f f f f f ff fff f f f f f
- -- f f f f f f f0f f fff f f f
- -- fff ff f f f f f fff f f f f ff --
- -------------------------------------------------------
- function enter()
- file = fs.open("/."..user,"r")
- none = file.readLine()
- ueds = file.readLine()
- file.close()
- term.clear()
- term.setCursorPos(14,1)
- print " "
- print " "
- print " "
- print " "
- print " "
- print " "
- ba = paintutils.loadImage("bank")
- paintutils.drawImage(ba,1,1)
- term.setCursorPos(1,10)
- print "Deposit"
- print "Withdraw"
- print "Transfer"
- print "Print Balance"
- print "Logout"
- print "------------------------------------"
- print ("| Balance: "..ueds)
- print "------------------------------------"
- ingo = "1"
- while ingo == "1" do
- local event, button, X, Y = os.pullEventRaw("mouse_click")
- if X >=1 and X <=7 and Y == 10 and button == 1 then
- term.clear()
- ba = paintutils.loadImage("bank")
- paintutils.drawImage(ba,1,1)
- write "Deposit: "
- dep = tonumber(read())
- mon = ueds + dep
- file = fs.open("/."..user,"w")
- file.writeLine(cpass)
- file.writeLine(mon)
- file.close()
- enter()
- elseif X >=1 and X <=8 and Y == 11 and button == 1 then
- term.clear()
- ba = paintutils.loadImage("bank")
- paintutils.drawImage(ba,1,1)
- write "Withdraw: "
- with = tonumber(read())
- mon = ueds - dep
- file = fs.open("/."..user,"w")
- file.writeLine(cpass)
- file.writeLine(mon)
- file.close()
- enter()
- elseif X >=1 and X <=7 and Y == 14 and button == 1 then
- term.clear()
- os.reboot()
- elseif X >=1 and X <=13 and Y == 12 and button == 1 then
- write("From: ")
- from = read()
- write("To: ")
- to = read()
- write("Amount: ")
- amount = tonumber(read())
- if fs.exists("/."..from) and fs.exists("/."..to) then
- file = fs.open("/."..from,"r")
- n = file.readLine()
- p1 = tonumber(file.readLine())
- file.close()
- file = fs.open("/."..to,"r")
- o = file.readLine()
- p2 = tonumber(file.readLine())
- file.close()
- minus = p1 - amount
- add = p2 + amount
- file = fs.open("/."..from,"w")
- file.writeLine(n)
- file.writeLine(minus)
- file.close()
- file = fs.open("/."..to,"w")
- file.writeLine(o)
- file.writeLine(add)
- file.close()
- print "Transfer Complete!"
- event = os.pullEvent()
- enter()
- else
- print ("Error: "..from.. " Or "..to.." Doesnt Exist")
- event = os.pullEvent()
- enter()
- end
- elseif X >=1 and X <=13 and Y == 13 and button == 1 then
- printer = peripheral.wrap("left")
- printer.newPage()
- printer.setPageTitle(user.."'s Balance")
- printer.setCursorPos(2,1)
- printer.write("Account Name: "..user)
- printer.setCursorPos(1,4)
- printer.write("--------------------------------")
- printer.setCursorPos(2,6)
- printer.write("Balance: "..ueds)
- printer.setCursorPos(1,8)
- printer.write("--------------------------------")
- printer.setCursorPos(1,9)
- local time = os.time()
- printer.write("Printed At: "..time)
- printer.setCursorPos(1,11)
- printer.write("--------------------------------")
- printer.endPage()
- print("Printed Balance At: "..time)
- event = os.pullEvent()
- enter()
- end
- end
- end
- ingo = "0"
- term.clear()
- term.setCursorPos(10,1)
- print " Login "--19
- term.setCursorPos(10,2)
- print "-----------------"
- term.setCursorPos(10,3)
- print "User: " --13 user
- term.setCursorPos(10,4)
- print "-----------------"
- term.setCursorPos(10,5)
- print "Pass: " --15 pass
- term.setCursorPos(10,6)
- print "-----------------"
- term.setCursorPos(10,7)
- print " "
- term.setCursorPos(10,8)
- print " Login " --18 login
- term.setCursorPos(10,9)
- print " "
- term.setCursorPos(10,10)
- print " "
- term.setCursorPos(10,11)
- print " Create Account " --21 create
- term.setCursorPos(10,12)
- print " "
- ------------------------------------------
- while ingo == "0" do
- local event, button, X, Y = os.pullEventRaw("mouse_click")
- if X >=10 and X <=26 and Y == 3 and button == 1 then -- User
- term.setCursorPos(15,3)
- write " "
- user = read()
- elseif X >=10 and X <=26 and Y == 5 and button == 1 then -- Pass
- term.setCursorPos(15,5)
- write " "
- pass = read("*")
- elseif X >=10 and X <=26 and Y == 8 and button == 1 then -- Login
- if fs.exists("/."..user) then
- file = fs.open("/."..user,"r")
- cpass = file.readLine()
- file.close()
- if pass == cpass then
- term.setCursorPos(1,15)
- print("Wellcome "..user.." :) !")
- sleep(2)
- enter()
- else
- term.setCursorPos(1,15)
- print "INVAILID PASSWORD!!!!"
- sleep(2)
- os.reboot()
- end
- else
- term.setCursorPos(1,15)
- print "INVALID USER!"
- sleep(2)
- os.reboot()
- end
- elseif X >=1 and X <=26 and Y == 11 and button == 1 then -- Create Account
- term.clear()
- term.setCursorPos(1,1)
- print " Setup "--19
- print "-----------------"
- print "User: " --3 user
- print "-----------------"
- print "Pass: " --5 pass
- print "-----------------"
- term.setCursorPos(6,3)
- write " "
- newuse = read()
- term.setCursorPos(6,5)
- write " "
- newpass = read()
- if fs.exists("/."..newuse) then
- term.setCursorPos(1,15)
- print "Error Account Name Not Available!!"
- event = os.pullEvent()
- shell.run("start")
- else
- file = fs.open("/."..newuse,"w")
- file.writeLine(newpass)
- file.writeLine("0")
- file.close()
- sleep(2)
- print "Account Created!!"
- event = os.pullEvent()
- os.reboot()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement