Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- mon = peripheral.wrap("top")
- rednet.open("right")
- p = peripheral.wrap("bottom")
- uu = p.getItemIdentifierIDFor(30188,0)
- uuID = 30188
- dayTime = os.day()
- mon.clear()
- mon.setCursorPos(1,1)
- mon.setTextColor(colors.green)
- mon.setTextScale(0.5)
- timeC = 0
- os.loadAPI("ocs/apis/sensor")
- sen = sensor.wrap("back")
- function getItemCount()
- i = 0
- s = sen.getTargets()
- for v, k in pairs(s) do
- if k.Name == "ME Wireless Access Point" then
- targPos = v
- end
- if targPos == nil then
- i = 0
- else
- s1 = sen.getTargetDetails(targPos)
- for v1, k1 in pairs(s1.Items) do
- if k1.Name == "UU-Matter" then
- i = k1.Size
- end
- end
- end
- end
- cbut(2,15,"Bank UU-Matter:" .. i .. " ",colors.cyan,colors.black)
- return i
- end
- if fs.exists("time") == false then
- cFile = fs.open("time","w")
- cFile.writeLine(math.floor(0))
- cFile.close()
- bankTime = 0
- else
- rFile = fs.open("time","r")
- curTime = rFile.readLine()
- rFile.close()
- if curTime == "" or curTime == nil then
- curTime = 0
- end
- bankTime = math.floor(curTime)
- end
- function saveTime(n)
- sFile = fs.open("time","w")
- if n == nil or n == "" then
- n = 0
- end
- sFile.writeLine(math.floor(n))
- sFile.close()
- end
- function cbut(cx,cy,text,bcol,tcol)
- if bcol == nil then
- bcol = colors.black
- end
- if tcol == nil then
- tcol = colors.green
- end
- mon.setBackgroundColor(bcol)
- mon.setTextColor(tcol)
- mon.setCursorPos(cx,cy)
- mon.write(text)
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.green)
- end
- bankUU = 0
- gx, gy = mon.getSize()
- gxH = gx / 2
- gyH = gy / 2
- function clearMsgLine()
- cbut(2,gy - 2," ",nil,colors.orange)
- cbut(2,gy - 1," ",nil,colors.orange)
- cbut(2,gy," ",nil,colors.orange)
- end
- function wlan(col)
- if col == nil then
- col = colors.red
- end
- cbut(51,gy-10," ",col)
- cbut(50,gy-9," ",col)
- cbut(49,gy-8," ",col)
- cbut(49,gy-7," ",col)
- cbut(49,gy-6," ",col)
- cbut(50,gy-5," ",col)
- cbut(51,gy-4," ",col)
- cbut(53,gy-9," ",col)
- cbut(52,gy-8," ",col)
- cbut(52,gy-7," ",col)
- cbut(52,gy-6," ",col)
- cbut(53,gy-5," ",col)
- cbut(55,gy-6," ",col)
- cbut(54,gy-7," ",col)
- cbut(55,gy-8," ",col)
- end
- function startscreen(gCol)
- m = getItemCount()
- if m == nil then
- wlanCol = colors.red
- else
- wlanCol = colors.green
- end
- if timeC == nil then
- timeC = 0
- end
- if gcol == nil then
- gcol = colors.red
- end
- mon.clear()
- cbut(gxH -13 ,2,"Willkommen bei der UU-Bank")
- cbut(2,4,"Hier kannst du UU-Matter einzahlen und Abheben")
- cbut(2,6,"Dazu wird eine DISK benötigt.")
- cbut(2,7,"Diese erhälst du von Muzze77")
- cbut(2,8,"/mail send Muzze77 [Anfrage] : UU-Bank Account anmeldung")
- cbut(2,10,"Nach 12 MC Tagen bekommst du ein Bonus:",nil,colors.yellow)
- cbut(2,11,"ab 100 UU -> 1 UU",nil,colors.yellow)
- cbut(2,12,"ab 500 UU -> 4 UU",nil,colors.yellow)
- cbut(2,13,"ab 1000 UU -> 16 UU",nil,colors.yellow)
- cbut(2,14,"ab 5000 UU -> 64 UU",nil,colors.yellow)
- cbut(2,15,"Bank UU-Matter:" .. m .. " ",colors.cyan,colors.black)
- clearMsgLine()
- cbut(2,gy - 2,"Disk einwerfen um Kontostand abzufragen",nil,colors.orange)
- cbut(gx-9,gy - 2,"EINZAHLEN",colors.blue,colors.orange)
- cbut(gx-9,gy - 1,"AUSZAHLEN",colors.red, colors.orange)
- cbut(gxH-8,16," [ACCOUNT] ",colors.yellow,colors.black)
- cbut(gxH-8,17," --------- ",colors.yellow,colors.black)
- cbut(gxH-8,19,"[KONTOSTAND]",colors.yellow,colors.black)
- cbut(gxH-8,20,"------------",colors.yellow,colors.black)
- cbut(gxH-8,21,"Bonus Tage:" .. timeC .. " ",colors.yellow,colors.black)
- bankTime = os.day()
- cbut(36,1,"Day: ",colors.red,colors.black)
- cbut(36,1,"Day: " .. bankTime,colors.red,colors.black)
- wlan(gCol)
- end
- wlanCol = colors.red
- startscreen(wlanCol)
- function loadUser()
- sleep(0.5)
- term.setCursorPos(2,2)
- term.write("List User")
- x = 2
- y = 3
- list = fs.list("")
- i = 1
- for v ,k in pairs(list) do
- if k == "1" or k == "startup" or k == "rom" or k == "disk" or k == "time" or k == "update" then
- else
- term.setCursorPos(x,y)
- term.write(" " .. i .. " " .. k)
- i = i + 1
- x = x + 14
- if x > 42 then
- x = 2
- y = y + 1
- end
- end
- end
- end
- function delUser()
- mp = "MZ115"
- term.setCursorPos(2,2)
- term.write("enter Masterpassword")
- term.setCursorPos(2,3)
- code = read("*")
- if code == mp then
- term.setCursorPos(2,5)
- term.write("Enter Username")
- term.setCursorPos(2,6)
- uname = io.read()
- if fs.exists(uname) then
- fs.delete(uname)
- tab = {["Key"] = "Delete",["Name"]=uname}
- rednet.broadcast(textutils.serialize(tab))
- sleep(0.02)
- term.setCursorPos(2,8)
- mon.write("User geloescht")
- else
- term.setCursorPos(2,8)
- mon.write("User nicht gefunden")
- end
- sleep(1)
- term.clear()
- end
- end
- function createUser()
- sleep(0.5)
- mp = "MZ115"
- term.setCursorPos(2,2)
- term.write("enter Masterpassword")
- term.setCursorPos(2,3)
- code = read("*")
- if code == mp then
- term.setCursorPos(2,5)
- term.write("Enter Username")
- term.setCursorPos(2,7)
- term.write("Enter UID")
- term.setCursorPos(2,6)
- uname = io.read()
- term.setCursorPos(2,9)
- if fs.exists(uname) then
- term.write("User existiert bereits")
- else
- term.setCursorPos(2,8)
- numcode = math.random(0,9) .. math.random(0,9).. math.random(0,9) .. math.random(0,9)..math.random(0,9)..math.random(0,9)..math.random(0,9)..math.random(0,9)
- term.write(numcode)
- term.setCursorPos(2,9)
- term.write("DISK einlegen")
- evt = os.pullEvent("disk")
- term.setCursorPos(2,10)
- term.write("User wird erstellt")
- sleep(0.2)
- cUser = fs.open(uname,"w")
- cUser.writeLine(0) -- Moneycount
- cUser.writeLine(0.0) -- Timecount
- cUser.writeLine(os.day()) -- Last logintime
- cUser.writeLine(numcode) -- UID
- cUser.close()
- tab = {["Key"] = "Create",["Name"]=uname,["Money"] = 0,["Time"] = 0.0,["LastLogin"] = 0.0,["UID"] = numcode}
- rednet.broadcast(textutils.serialize(tab))
- sleep(0.02)
- cDisk = fs.open("disk/key","w")
- cDisk.writeLine(numcode)
- cDisk.writeLine("Code nicht aendern! Code ist an User gebunden")
- cDisk.close()
- disk.setLabel("left",uname)
- term.setCursorPos(2,11)
- term.write("User :" .. uname .. " mit UID:" .. numcode .. " erstellt")
- term.setCursorPos(2,12)
- term.write("Disk entnehmen")
- evt = os.pullEvent("disk_eject")
- end
- end
- sleep(1)
- term.clear()
- end
- einz = 0
- ausz = 0
- p = peripheral.wrap("bottom")
- while true do
- evt , keys, side,id,msg = os.pullEventRaw()
- term.clear()
- term.setCursorPos(1,1)
- print("Evt: " .. evt)
- startscreen(wlanCol)
- if evt == "terminate" then
- break
- end
- if evt == "disk_eject" then
- dayTime = os.day()
- cbut(36,20,"Zeit: " .. dayTime,colors.red,colors.black)
- startscreen(wlanCol)
- end
- if evt == "disk" then
- startscreen(wlanCol)
- clearMsgLine()
- cbut(2,gy - 2,"Methode waehlen ->",nil,colors.orange)
- cbut(2,gy - 1,"Methode waehlen ->",nil,colors.orange)
- uname = disk.getLabel("left")
- lUser = fs.open(uname,"r")
- money = tonumber(lUser.readLine())
- timeC = lUser.readLine()
- lastLogin = lUser.readLine()
- curTime = os.day()
- calTime = curTime - lastLogin
- if calTime >= 12 then
- timeC = 0
- if money >= 0 or money <= 100 then
- money = money + 1
- elseif money > 100 or money <= 500 then
- money = money + 4
- elseif money > 500 or money <= 1000 then
- money = money + 16
- elseif money > 5000 then
- money = money + 64
- end
- elseif calTime < 12 then
- timeC = calTime
- end
- uid = lUser.readLine()
- lUser.close()
- tab = {["Key"] = "Update",["Name"]=uname,["Money"] = money ,["Time"] = timeC,["LastLogin"] = lastLogin,["UID"] = uid}
- rednet.broadcast(textutils.serialize(tab))
- cbut(gxH-8,17," " .. uname .. " ",colors.yellow,colors.black)
- cbut(gxH-8,20," " .. money .. " ",colors.yellow,colors.black)
- cbut(2,21,"Bonus Tage:" .. timeC .. " ",colors.yellow,colors.black)
- cbut(2,gy ,"[Abbrechen]",nil,colors.orange)
- evt , side, x1, y1 = os.pullEvent("monitor_touch")
- if x1 >= 2 and x1 <= 12 and y1 == gy then
- disk.eject("left")
- end
- sleep(0.02)
- end
- if evt == "char" then
- if keys == "u" or key == "U" then
- shell.run("update")
- end
- if keys == "l" or key == "L" then
- loadUser()
- end
- if keys == "d" or key == "D" then
- loadUser()
- delUser()
- end
- if keys == "c" or key == "C" then
- createUser()
- end
- end
- if evt == "monitor_touch" then
- x = side
- y = id
- if x >= 2 and x <= 12 and y == gy then
- disk.eject("left")
- end
- if y == gy-1 and x >= 48 and x <= 56 then
- dayTime = os.day()
- cbut(36,20,"Zeit: " .. dayTime,colors.red,colors.black)
- if ausz == 0 then
- ausz = 1
- gNum = {}
- b = 0
- f = 0
- cbut(gx-9,gy - 1,"AUSZAHLEN",colors.red,colors.green)
- clearMsgLine()
- cbut(2,gy - 2,"Disk einwerfen um Auszahlung zu starten",nil,colors.orange)
- if disk.isPresent("left") then
- uname = disk.getLabel("left")
- else
- evt = os.pullEvent("disk")
- uname = disk.getLabel("left")
- end
- cbut(3,gy-4,"_",colors.white)
- cbut(4,gy-4,"_",colors.white)
- cbut(5,gy-4,"_",colors.white)
- cbut(6,gy-4,"_",colors.white)
- cbut(7,gy-4,"_",colors.white)
- cbut(4,gy-8,"1",colors.white)
- cbut(5,gy-8,"2",colors.white)
- cbut(6,gy-8,"3",colors.white)
- cbut(4,gy-7,"4",colors.white)
- cbut(5,gy-7,"5",colors.white)
- cbut(6,gy-7,"6",colors.white)
- cbut(4,gy-6,"7",colors.white)
- cbut(5,gy-6,"8",colors.white)
- cbut(6,gy-6,"9",colors.white)
- cbut(4,gy-5,"C",colors.white)
- cbut(5,gy-5,"0",colors.white)
- cbut(6,gy-5,"<",colors.white)
- while b == 0 do
- if uname == nil then
- disk.eject("left")
- clearMsgLine()
- cbut(2,gy - 2,"User konnte nicht geladen werden!",nil,colors.orange)
- disk.eject("left")
- sleep(2)
- b = 1
- else
- nBank = getItemCount()
- lUser = fs.open(uname,"r")
- money = lUser.readLine()
- timeC = lUser.readLine()
- lastLogin = lUser.readLine()
- curTime = os.day()
- calTime = curTime - lastLogin
- print("Usermoney = " .. money)
- if calTime >= 12 then
- timeC = 0
- if money >= 0 or money <= 100 then
- money = money + 1
- elseif money > 100 or money <= 500 then
- money = money + 4
- elseif money > 500 or money <= 1000 then
- money = money + 16
- elseif money > 5000 then
- money = money + 64
- end
- elseif calTime < 12 then
- timeC = calTime
- end
- uid = lUser.readLine()
- lUser.close()
- d = fs.open("disk/key","r")
- diskUID = d.readLine()
- d.close()
- cbut(gxH-8,17," " .. uname .. " ",colors.yellow,colors.black)
- cbut(gxH-8,20," " .. money .. " ",colors.yellow,colors.black)
- cbut(2,21,"Bonus Tage:" .. timeC .. " ",colors.yellow,colors.black)
- iCount = getItemCount()
- clearMsgLine()
- cbut(2,gy ,"[Abbrechen]",nil,colors.orange)
- cbut(24,gy ,"[Bestätigen]",nil,colors.orange)
- evt, side, x, y = os.pullEvent("monitor_touch")
- if x >= 2 and x <= 12 and y == gy then
- cbut(2,gy ,"[Abbrechen]",nil,colors.red)
- sleep(0.1)
- clearMsgLine()
- cbut(2,gy - 2,"Abgebrochen",nil,colors.orange)
- disk.eject("left")
- sleep(2)
- b = 1
- end
- if x >= 24 and x <= 34 and y == gy then
- if f == 0 then
- cbut(24,gy ,"[Bestätigen]",nil,colors.red)
- sleep(0.1)
- clearMsgLine()
- cbut(2,gy - 2,"Nichts ausgewählt",nil,colors.orange)
- disk.eject("left")
- sleep(2)
- b = 1
- else
- for nC = 1,#gNum,1 do
- if numStr == nil then
- numStr = gNum[nC]
- else
- numStr = numStr .. gNum[nC]
- end
- end
- money = tonumber(money)
- numInt = tonumber(numStr)
- if numInt > money then
- cbut(24,gy ,"[Bestätigen]",nil,colors.red)
- sleep(0.1)
- clearMsgLine()
- cbut(2,gy - 2,"Nicht genug auf UU-Matter auf deinem Account",nil,colors.orange)
- sleep(2)
- elseif numInt > nBank then
- cbut(24,gy ,"[Bestätigen]",nil,colors.red)
- sleep(0.1)
- clearMsgLine()
- cbut(2,gy - 2,"Nicht genug auf UU-Matter auf der Bank",nil,colors.orange)
- cbut(2,gy - 1,"Bitte Muzze77 Kontaktieren",nil,colors.orange)
- sleep(2)
- else
- fs.delete(uname)
- uUser = fs.open(uname,"w")
- uUser.writeLine(money - numInt) -- Moneycount
- uUser.writeLine(timeC) -- Timecount
- uUser.writeLine(lastLogin) -- Last logintime
- uUser.writeLine(uid) -- UID
- uUser.close()
- p = peripheral.wrap("bottom")
- uu = p.getItemIdentifierIDFor(30188,0)
- p.makeRequest(uu,numInt)
- cbut(24,gy ,"[Bestätigen]",nil,colors.red)
- sleep(0.1)
- clearMsgLine()
- cbut(2,gy - 2,numInt .. " UU-Matter wird ausgezahlt",nil,colors.orange)
- disk.eject("left")
- sleep(2)
- b = 1
- end
- end
- end
- if x == 4 and y == gy-8 then
- if f < 6 then
- cbut(4,gy-8,"1",colors.white,colors.red)
- table.insert(gNum,"1")
- sleep(0.02)
- cbut(4,gy-8,"1",colors.white)
- f = f + 1
- end
- end
- if x == 5 and y == gy- 8 then
- if f < 6 then
- cbut(5,gy-8,"2",colors.white,colors.red)
- table.insert(gNum,"2")
- sleep(0.01)
- cbut(5,gy-8,"2",colors.white)
- f = f + 1
- end
- end
- if x == 6 and y == gy- 8 then
- if f < 6 then
- cbut(6,gy-8,"3",colors.white,colors.red)
- table.insert(gNum,"3")
- sleep(0.01)
- cbut(6,gy-8,"3",colors.white)
- f = f + 1
- end
- end
- if x == 4 and y == gy-7 then
- if f < 6 then
- cbut(4,gy-7,"4",colors.white,colors.red)
- table.insert(gNum,"4")
- sleep(0.01)
- cbut(4,gy-7,"4",colors.white)
- f = f + 1
- end
- end
- if x == 5 and y == gy-7 then
- if f < 6 then
- cbut(5,gy-7,"5",colors.white,colors.red)
- table.insert(gNum,"5")
- sleep(0.01)
- cbut(5,gy-7,"5",colors.white)
- f = f + 1
- end
- end
- if x == 6 and y == gy-7 then
- if f < 6 then
- cbut(6,gy-7,"6",colors.white,colors.red)
- table.insert(gNum,"6")
- sleep(0.01)
- cbut(6,gy-7,"6",colors.white)
- f = f + 1
- end
- end
- if x == 4 and y == gy-6 then
- if f < 6 then
- cbut(4,gy-6,"7",colors.white,colors.red)
- table.insert(gNum,"6")
- sleep(0.01)
- cbut(4,gy-6,"7",colors.white)
- f = f + 1
- end
- end
- if x == 5 and y == gy-6 then
- if f < 6 then
- cbut(5,gy-6,"8",colors.white,colors.red)
- table.insert(gNum,"8")
- sleep(0.01)
- cbut(5,gy-6,"8",colors.white)
- f = f + 1
- end
- end
- if x == 6 and y == gy-6 then
- if f < 6 then
- cbut(6,gy-6,"9",colors.white,colors.red)
- table.insert(gNum,"9")
- sleep(0.01)
- cbut(6,gy-6,"9",colors.white)
- f = f + 1
- end
- end
- if x == 5 and y == gy-5 then
- if f < 6 and f > 0 then
- cbut(5,gy-5,"0",colors.white,colors.red)
- table.insert(gNum,"0")
- sleep(0.01)
- cbut(5,gy-5,"0",colors.white)
- f = f + 1
- end
- end
- if x == 4 and y == gy-5 then
- cbut(4,gy-5,"C",colors.white,colors.red)
- sleep(0.01)
- cbut(4,gy-5,"C",colors.white)
- gNum = {}
- f = 0
- end
- if x == 6 and y == gy-5 then
- cbut(6,gy-5,"<",colors.white,colors.red)
- sleep(0.01)
- cbut(6,gy-5,"<",colors.white)
- gNum[#gNum] = nil
- f = f - 1
- end
- if f > 0 then
- for v = 1, 5, 1 do
- if gNum[v] == nil then
- cbut(v+2,gy-4,"_",colors.white)
- else
- cbut(v+2,gy-4,gNum[v],colors.white)
- end
- end
- else
- cbut(3,gy-4,"_",colors.white)
- cbut(4,gy-4,"_",colors.white)
- cbut(5,gy-4,"_",colors.white)
- cbut(6,gy-4,"_",colors.white)
- cbut(7,gy-4,"_",colors.white)
- end
- end
- end
- tab = {["Key"] = "Update",["Name"]=uname,["Money"] = money ,["Time"] = timeC,["LastLogin"] = lastLogin,["UID"] = uid}
- rednet.broadcast(textutils.serialize(tab))
- sleep(0.01)
- end
- elseif ausz == 1 then
- ausz = 0
- cbut(gx-9,gy - 1,"AUSZAHLEN",colors.red,colors.green)
- clearMsgLine()
- cbut(2,gy - 2,"Disk einwerfen um Kontostand abzufragen",nil,colors.orange)
- end
- if y == gy-2 and x >= 48 and x <= 56 then
- if einz == 0 then
- einz = 1
- cbut(gx-9,gy - 2,"EINZAHLEN",colors.blue,colors.green)
- clearMsgLine()
- cbut(2,gy - 2,"Disk einwerfen um Einzahlung zu starten",nil,colors.orange)
- if disk.isPresent("left") then
- uname = disk.getLabel("left")
- else
- evt = os.pullEvent("disk")
- uname = disk.getLabel("left")
- end
- if uname == nil then
- disk.eject("left")
- clearMsgLine()
- cbut(2,gy - 2,"User konnte nicht geladen werden!",nil,colors.orange)
- disk.eject("left")
- sleep(2)
- shell.run("1")
- else
- lUser = fs.open(uname,"r")
- money = tonumber(lUser.readLine())
- timeC = lUser.readLine()
- lastLogin = lUser.readLine()
- curTime = os.day()
- calTime = curTime - lastLogin
- if calTime >= 12 then
- timeC = 0
- if money >= 0 or money <= 100 then
- money = money + 1
- elseif money > 100 or money <= 500 then
- money = money + 4
- elseif money > 500 or money <= 1000 then
- money = money + 16
- elseif money > 5000 then
- money = money + 64
- end
- elseif calTime < 12 then
- timeC = calTime
- end
- uid = lUser.readLine()
- lUser.close()
- d = fs.open("disk/key","r")
- diskUID = d.readLine()
- d.close()
- cbut(gxH-8,17," " .. uname .. " ",colors.yellow,colors.black)
- cbut(gxH-8,20," " .. money .. " ",colors.yellow,colors.black)
- cbut(2,21,"Bonus Tage:" .. timeC .. " ",colors.yellow,colors.black)
- iCount = getItemCount()
- clearMsgLine()
- cbut(2,gy - 2,"Zum einzahlen UU-Matter gegen den Collector",nil,colors.orange)
- cbut(2,gy - 1,"werfen. Nach einwurf auf Monitor klicken",nil,colors.orange)
- cbut(2,gy ,"[Abbrechen]",nil,colors.orange)
- cbut(24,gy ,"[Bestätigen]",nil,colors.orange)
- sleep(2)
- b = 0
- while b == 0 do
- evt,side, x, y = os.pullEvent("monitor_touch")
- sleep(0.05)
- niCount = getItemCount()
- c = niCount - iCount
- if x>= 24 and x <= 34 and y == gy then
- cbut(24,gy ,"[Bestätigen]",nil,colors.red)
- sleep(0.1)
- b = 1
- if uid == diskUID then
- uUser = fs.open(uname,"w")
- uUser.writeLine(money + c)
- uUser.writeLine(timeC)
- uUser.writeLine(os.day())
- uUser.writeLine(uid)
- uUser.close()
- tab = {["Key"] = "Update",["Name"]=uname,["Money"] = money + c ,["Time"] = timeC,["LastLogin"] = lastLogin,["UID"] = uid}
- rednet.broadcast(textutils.serialize(tab))
- clearMsgLine()
- cbut(2,gy - 2,c .. " UU-Matter eingezahlt",nil,colors.orange)
- cbut(gxH-8,17," " .. uname .. " ",colors.yellow,colors.black)
- cbut(gxH-8,20," " .. money + c.. " ",colors.yellow,colors.black)
- disk.eject("left")
- sleep(2)
- b = 1
- else
- if c > 0 then
- p = peripheral.wrap("bottom")
- uu = p.getItemIdentifierIDFor(30188,0)
- p.makeRequest(uu,c)
- end
- clearMsgLine()
- cbut(2,gy - 2,"Code ist falsch ",nil,colors.orange)
- disk.eject("left")
- sleep(2)
- b = 1
- end
- end
- if x >= 2 and x <= 12 and y == gy then
- cbut(2,gy ,"[Abbrechen]",nil,colors.red)
- sleep(0.1)
- rednet.broadcast("getItemCount")
- c = niCount - iCount
- if c > 0 then
- p = peripheral.wrap("bottom")
- uu = p.getItemIdentifierIDFor(30188,0)
- p.makeRequest(uu,c)
- end
- clearMsgLine()
- cbut(2,gy - 2,"Abgebrochen",nil,colors.orange)
- disk.eject("left")
- sleep(2)
- b = 1
- end
- end
- end
- elseif einz == 1 then
- einz = 0
- cbut(gx-9,gy - 2,"EINZAHLEN",colors.blue,colors.orange)
- clearMsgLine()
- cbut(2,gy - 2,"Disk einwerfen um Kontostand abzufragen",nil,colors.orange)
- end
- end
- end
- if evt == "rednet_message" then
- --print("ID: " .. id .. " send Msg: " .. msg)
- sleep(1)
- g = string.match(side,"Key")
- if g then
- tab = textutils.unserialize(side)
- if tab.Key == "getItemCount" then
- wlan(colors.green)
- end
- if tab.Key == "Create" then
- if fs.exists(tab.Name) then
- print("User found")
- else
- cUser = fs.open(tab.Name,"w")
- cUser.writeLine(tab.Money) -- Moneycount
- cUser.writeLine(tab.Time) -- Timecount
- cUser.writeLine(os.day()) -- Last logintime
- cUser.writeLine(tab.UID) -- UID
- cUser.close()
- end
- end
- if tab.Key == "Update" then
- if fs.exists(tab.Name) then
- fs.delete(tab.Name)
- uUser = fs.open(tab.Name,"w")
- uUser.writeLine(tab.Money) -- Moneycount
- uUser.writeLine(tab.Time) -- Timecount
- uUser.writeLine(os.day()) -- Last logintime
- uUser.writeLine(tab.UID) -- UID
- uUser.close()
- else
- cUser = fs.open(tab.Name,"w")
- cUser.writeLine(tab.Money) -- Moneycount
- cUser.writeLine(tab.Time) -- Timecount
- cUser.writeLine(os.day()) -- Last logintime
- cUser.writeLine(tab.UID) -- UID
- cUser.close()
- end
- end
- if tab.Key == "Delete" then
- if fs.exists(tab.Name) then
- fs.delete(tab.Name)
- end
- end
- end
- end
- bankTime = os.day()
- cbut(36,1,"Day: ",colors.red,colors.black)
- cbut(36,1,"Day: " .. bankTime,colors.red,colors.black)
- end
Add Comment
Please, Sign In to add comment