Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- v 4.22
- -- v 1.04
- --[[
- Youtube Channel: https://www.youtube.com/channel/UCm9wGh5xdCNP2-rly5n2yEQ
- tervek: tetszik menüpont, rednet hálózat, biztonsági kockázatok kiküszöbölése
- 2015.11.04 Root jelszo megvaltoztatasara rakenyszerit (nem lehet at ugrani a kerest), pastebin oldal ellenorzese frissites elott
- 2015.11.03 Jogrendszer modositva! Mostantol a tiltott jogokat nem tudja a felhasznało vissza adni sajat maganak, kiirja a bejelentkezett nevet
- mostantol kulon verzioszam alapjan figyeli a nyelvi verziokat, Uj jog: felhasznalo letrehozasa
- 2015.11.02 jelszot msot mar minden komolyabb muvelethez elkeri, hotfix: jogosultsag rendszer, uj felhasznalo
- 2015.11.01 Ujrairt jogosultsag kezelo rendszer
- 2015.10.31 felhasználÄ‚Ĺ‚ felvĂ©tele Ă©s jelszÄ‚Ĺ‚kezelĹ‿ Ä‚ĹźjraÄ‚ÂÂrva, javÄ‚ÂÂtások
- automatikusan kikapcsol 3 perc után, printmenu kĂ©pernyĹ‿ mĂ©retĂ©hez igazodik, fordÄ‚ÂÂtások folytatása,
- 2015.10.30 idozitett menu hozzaadva (1 perc inaktivitas utan kilep majd kikapcsol), modositott frissito rendszer
- 2015.10.29 többnyelvű támogatás hozzáadva, javÄ‚ÂÂtások
- 2015.10.28 felhasználĂłk törlĂ©se hozzáadva, jelszĂłt mostantĂłl hasheli, program kioldhatĂł (numpad gobbal vihetĹ‿ be a számok)
- 2015.10.28 add user delete permission change, add string hash, add security program broken
- ]]--
- local pullEvent = os.pullEvent
- os.pullEvent = os.pullEventRaw
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function StringHash(text)
- local counter = 1
- local len = string.len(text)
- for i = 1, len, 3 do
- counter = math.fmod(counter*8161, 4294967279) +
- (string.byte(text,i)*16776193) +
- ((string.byte(text,i+1) or (len-i+256))*8372226) +
- ((string.byte(text,i+2) or (len-i+256))*3932164)
- end
- return math.fmod(counter, 4294967291)
- end
- if not fs.exists("database/root") then -- if database dir not found / ha a database mappa nem létezik
- if not fs.exists("database") then
- fs.makeDir("database")
- end
- file = fs.open("database/root", "w")
- root = tostring(StringHash("root"))
- file.writeLine(root) -- create root password / root jelszÄ‚Ĺ‚ Ä‚ÂÂrása
- file.writeLine("true") -- create root permissions / root permission Ä‚ÂÂrása
- file.writeLine("true")
- file.writeLine("true")
- file.writeLine("true")
- file.writeLine("true")
- file.writeLine("true")
- file.close()
- end
- function langdircreate()
- if not fs.exists("language") then -- create language dir if not found / nyelvi könyvtár kĂ©szÄ‚ÂÂtĂ©se
- fs.makeDir("language")
- end
- end
- if not fs.exists("language/en") then -- create languages file if not found / nyelvek telepÄ‚ÂÂtĂ©se
- langdircreate()
- shell.run("pastebin","get","F97sTnpZ","language/en") clear()
- end
- if not fs.exists("language/de") then
- langdircreate()
- shell.run("pastebin","get","b4PyFVQ2","language/de") clear()
- end
- if not fs.exists("language/hu") then
- langdircreate()
- shell.run("pastebin","get","1AakPMkR","language/hu") clear()
- end
- if not fs.exists("language/setlang") then -- create languages file if not found / nyelvek telepÄ‚ÂÂtĂ©se
- langdircreate()
- setlang = fs.open("language/setlang", "w")
- setlang.writeLine("-- v 1.00")
- setlang.writeLine("hu")
- setlang.close()
- end
- file = fs.open("language/setlang", "r")
- actlang = file.readLine()
- file.close()
- if actlang == "hu" or actlang == "en" or actlang == "de" then
- file = fs.open("language/setlang", "w")
- file.writeLine("-- v 1.00")
- file.writeLine(actlang)
- file.close()
- end
- if fs.exists("language") then
- setlang = fs.open("language/setlang", "r")
- setlang.readLine()
- selectedlang2 = setlang.readLine()
- setlang.close()
- print(selectedlang) sleep(1)
- end
- myTimer = 0
- local start = 0
- local stop = 1
- local selectedlang = selectedlang2
- local unlock = {}
- local index = 1
- local matrix1 = ""
- local matrix2 = ""
- local width, height = term.getSize()
- local selectedMenu = 1
- local selectedItem = 1
- local username = ""
- local adminjog = ""
- local doors = ""
- local windows = ""
- local delete = ""
- local running = true
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function language()
- lang = fs.open("language/"..selectedlang, "r")
- lang.readLine()
- lang1 = lang.readLine()
- lang2 = lang.readLine()
- lang3 = lang.readLine()
- lang4 = lang.readLine()
- lang5 = lang.readLine()
- lang6 = lang.readLine()
- lang7 = lang.readLine()
- lang8 = lang.readLine()
- lang9 = lang.readLine()
- lang10 = lang.readLine()
- lang11 = lang.readLine()
- lang12 = lang.readLine()
- lang13 = lang.readLine()
- lang14 = lang.readLine()
- lang15 = lang.readLine()
- lang16 = lang.readLine()
- lang17 = lang.readLine()
- lang18 = lang.readLine()
- lang19 = lang.readLine()
- lang20 = lang.readLine()
- lang21 = lang.readLine()
- lang22 = lang.readLine()
- lang23 = lang.readLine()
- lang24 = lang.readLine()
- lang.close()
- end
- function english()
- setlang = fs.open("language/setlang", "w")
- setlang.writeLine("-- v "..langversion)
- setlang.writeLine("en")
- setlang.close()
- shell.run("startup")
- end
- function deutsch()
- setlang = fs.open("language/setlang", "w")
- setlang.writeLine("-- v "..langversion)
- setlang.writeLine("de")
- setlang.close()
- shell.run("startup")
- end
- function magyar()
- setlang = fs.open("language/setlang", "w")
- setlang.writeLine("-- v "..langversion)
- setlang.writeLine("hu")
- setlang.close()
- shell.run("startup")
- main()
- end
- function updateStartup()
- nettest = http.get("http://pastebin.com")
- if nettest then
- print("internetkapcsolat aktiv") sleep(1)
- shell.run("pastebin","get","ANLXqv40","update") clear()
- local file = fs.open("update", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- ujverzio = tonumber(lx:sub(s1+2))
- lx = file.readLine()
- s1 = lx:find("v")
- newlangversion = tonumber(lx:sub(s1+2))
- file.close()
- print("newlang: ", newlangversion) sleep(2)
- local file = fs.open("startup", "r")
- lx = file.readLine()
- s1 = lx:find("v")
- regiverzio = tonumber(lx:sub(s1+2))
- lx = file.readLine()
- s1 = lx:find("v")
- langversion = tonumber(lx:sub(s1+2))
- file.close()
- clear()
- print("regiverzio: ", regiverzio)
- print("ujverzio: ", ujverzio)
- print("newlangversion: ", newlangversion)
- print("langversion: ", langversion)
- sleep(3)
- if regiverzio < ujverzio or regiverzio > ujverzio then
- fs.delete("startup")
- fs.copy("update", "startup")
- print("Program frissitve: ", regiverzio, " --> ", ujverzio)
- print("program ujratoltese") sleep(.4)
- shell.run("startup")
- else
- fs.delete("update")
- end
- if newlangversion < langversion or newlangversion > langversion then
- shell.run("pastebin","get","1AakPMkR","hu")
- clear()
- fs.delete("language/hu")
- fs.copy("hu", "language/hu")
- fs.delete("hu")
- shell.run("pastebin","get","F97sTnpZ","en")
- clear()
- fs.delete("language/en")
- fs.copy("en", "language/en")
- fs.delete("en")
- shell.run("pastebin","get","b4PyFVQ2","de")
- clear()
- fs.delete("language/de")
- fs.copy("de", "language/de")
- fs.delete("de")
- file = fs.open("language/setlang", "r")
- file.readLine()
- langsel = file.readLine()
- file.close()
- file = fs.open("language/setlang", "w")
- file.writeLine("-- v "..newlangversion)
- file.writeLine(langsel)
- file.close()
- print("Nyelv frissitve: ", langversion, " --> ", newlangversion) sleep(2)
- else
- print("nincs elerheto nyelvi frissites") sleep(.4)
- end
- else
- print("nem erheto el a pastebin oldal") sleep(1)
- end
- end
- updateStartup()
- language()
- function timer()
- if start == 1 then
- myTimer = os.startTimer(75)
- start = 0
- term.setCursorPos(width - 2, height - 1)
- print("o") sleep(.1)
- elseif stop == 1 then
- myTimer = os.startTimer(180)
- stop = 0
- term.setCursorPos(width - 2, height - 1)
- print("o") sleep(.1)
- end
- end
- function login()
- out = true
- timer()
- clear()
- print("The program created by Csaba")
- print(lang4..lang19)
- username = read()
- if username == "" then
- print("can not be ", lang18)
- sleep(.4)
- elseif not fs.exists("database/"..username) then
- print(lang4, "does not exist")
- sleep(.4)
- elseif fs.exists("database/"..username) then
- loads()
- print(lang3)
- passhash = read("*")
- pass = tostring(StringHash(passhash))
- if pass == "1" then
- print("can not be ", lang18)
- sleep(.4)
- elseif pass == goodpass then
- if adminjog == "true" then
- selectedMenu = 2
- elseif adminjog == "false" then
- selectedMenu = 3
- end
- print(lang3, " ", lang16)
- sleep(1)
- if goodpass == "1504751979" then
- while out do
- clear() print("uj jelszo")
- requestpass = read("*")
- newpass = tostring(StringHash(requestpass))
- if newpass == "1" then
- clear() print("jelszo nem lehet ures") sleep(1)
- elseif newpass == "1504751979" then
- clear() print("jelszo nem lehet azonos a regivel") sleep(1)
- else
- goodpass = newpass datawrite()
- clear() print("jelszo frissitve") sleep(1)
- out = false
- end
- end
- end
- else
- print(lang3, " ", lang20)
- sleep(.4)
- end
- end
- end
- function changepassword()
- if username ~= "root" then
- clear()
- print(lang3)
- requestpass = read("*")
- actualpass = tostring(StringHash(requestpass))
- if actualpass == goodpass then
- print(lang3, " ", lang16) clear()
- print( lang17, " ",lang3)
- requestpass = read("*")
- newpass = tostring(StringHash(requestpass))
- if newpass == "1" then -- ha a jelszĂł ĂĽres
- print("jelszo nem lehet ures") sleep(1)
- elseif newpass == goodpass then
- print("jelszo nem lehet azonos a regivel") sleep(1)
- else
- newpass = pass
- datawrite() clear()
- print( lang3, " ",lang24) sleep(1)
- end
- else
- clear() print(lang3, " ", lang20) sleep(1)
- end
- elseif username == "root" then clear()
- storepermissions()
- print(lang3)
- requestpass = read("*")
- actualpass = tostring(StringHash(requestpass))
- if actualpass == goodpass then clear()
- print(lang4..lang19)
- username = read()
- if username == "" then
- print("felhasznalonev nem lehet ures") sleep(1)
- elseif not fs.exists("database/"..username) then
- print("felhasznalo nem letezik") sleep(1)
- elseif fs.exists("database/"..username) then
- print(lang4, " ", lang24) clear()
- loads()
- print(lang17, " ", lang3)
- requestpass = read("*") -- kéri az új jelszót amit majd alkalmaz a felhasználóra
- newpass = tostring(StringHash(requestpass)) -- hashelés
- if newpass == "1" then clear()
- print("jelszo nem lehet ures") sleep(1)
- elseif newpass == goodpass then clear()
- print("jelszo nem lehet azonos a regivel") sleep(1)
- else
- goodpass = newpass
- datawrite()
- if username == "root" then oldgoodpass = newpass end clear()
- print(lang3, " ", lang15) sleep(1)
- end
- else
- print("felhasznalo nem talalhato!!!") sleep(1)
- end
- else
- print(lang3, " ", lang20) sleep(1)
- end
- end
- restorepermissions()
- end
- function createuser()
- if create == "true" then
- clear() print(lang3)
- passhashcheck = read("*")
- passhashcheck2 = tostring(StringHash(passhashcheck))
- if passhashcheck2 == goodpass then
- clear() print(lang3, " ", lang16)
- sleep(1)
- clear() print("username")
- newuser = read()
- if newuser == "" then
- print(lang4, " ", lang18) sleep(1)
- elseif fs.exists("database/"..newuser) then
- clear() print("user letezik") sleep(1)
- else
- print("password")
- newpasshash = read("*")
- if newpasshash == "" then
- print("password empty") sleep(1)
- else
- newpass = tostring(StringHash(newpasshash))
- print("admin access (i/n)")
- adminjog2 = read()
- if adminjog2 == "" then
- print("valasztott gomb csak i vagy n lehet")
- else
- if adminjog2 == "i" or adminjog2 == "I" then
- file = fs.open("database/"..newuser, "w")
- file.writeLine(newpass)
- file.writeLine("true")
- file.writeLine("true")
- file.writeLine("true")
- file.writeLine("true")
- file.writeLine("true")
- file.writeLine("true")
- file.close()
- elseif adminjog2 == "n" or adminjog2 == "N" then
- file = fs.open("database/"..newuser, "w")
- file.writeLine(newpass)
- file.writeLine("false")
- file.writeLine("false")
- file.writeLine("false")
- file.writeLine("false")
- file.writeLine("false")
- file.writeLine("false")
- file.close()
- else
- print("rossz gomb: csak 1 vagy 2 lehet")
- sleep(1)
- end
- end
- end
- end
- else
- print("rossz", lang3) sleep(1)
- end
- else
- print("You don't have enough permission")
- sleep(1)
- end
- end
- function alluser()
- clear()
- local filelist = fs.list("database/")
- for _, file in ipairs(filelist) do
- list = fs.open("database/"..file, "r")
- print(file)
- sleep(.2)
- end
- sleep(2)
- end
- function storepermissions()
- oldusername = username oldgoodpass = goodpass oldadminjog = adminjog olddoors = doors
- oldwindows = windows oldperm = perm oldcreate = create olddelete = delete
- end
- function restorepermissions()
- username = oldusername goodpass = oldgoodpass adminjog = oldadminjog doors = olddoors
- windows = oldwindows perm = oldperm create = oldcreate delete = olddelete
- end
- function permissions() -- permissions manager function / jogosultság kezelĹ‿ funkciĂł
- storepermissions()
- if perm == "true" then
- perms = {"adminjog", "doors", "windows", "perm","create", "delete"}
- clear ()
- print(lang3)
- passhashcheck = read("*") clear()
- passhashcheck2 = tostring(StringHash(passhashcheck))
- if passhashcheck2 == pass then
- print(lang4..lang19)
- username = read()
- if username == "" then
- print("felhasznalonev nem lehet ures") sleep(1)
- elseif not fs.exists("database/"..username) then
- print("felhasznalo nem talalhato") sleep(1)
- elseif fs.exists("database/"..username) then
- loads() term.clear()
- for i = 1, #perms do
- term.setCursorPos(1,i)
- print(i, ": ", perms[i]) i = i + 1
- end
- print("mire allitsam? 1 = true, 2 = false")
- event, key = os.pullEvent("key")
- if key == 79 then -- key1
- seljog = 1 what = 1
- print("selectedjog: ", seljog) sleep(1)
- jog = perms[seljog]
- print("kivalasztott jog: ", jog) sleep(1)
- elseif key == 80 then --key2
- seljog = 2 what = 1
- print(seljog) sleep(1)
- jog = perms[seljog]
- print("kivalasztott jog: ", jog) sleep(1)
- if oldusername == username and olddoors == "false" and oldusername ~= root then
- print("Neked ez a jog tiltva van!: "..jog) jog = nil sleep(1)
- end
- elseif key == 81 then --key3
- seljog = 3 what = 1
- print(seljog) sleep(1)
- jog = perms[seljog]
- print("kivalasztott jog: ", jog) sleep(1)
- if oldusername == username and oldwindows == "false" and oldusername ~= root then
- print("Neked ez a jog tiltva van!: "..jog) jog = nil sleep(1)
- end
- elseif key == 75 then --key4
- seljog = 4 what = 1
- print(seljog) sleep(1)
- jog = perms[seljog]
- print(jog) what = 1
- print("kivalasztott jog: ", jog) sleep(1)
- elseif key == 76 then --key5
- seljog = 5 what = 1
- print(seljog) sleep(1)
- jog = perms[seljog]
- print("kivalasztott jog: ", jog) sleep(1)
- if oldusername == username and create == "false" and oldusername ~= root then
- print("Neked ez a jog tiltva van!: "..jog) jog = nil sleep(1)
- end
- elseif key == 77 then --key5
- seljog = 6 what = 1
- print(seljog) sleep(1)
- jog = perms[seljog]
- print("kivalasztott jog: ", jog) sleep(1)
- if oldusername == username and olddelete == "false" and oldusername ~= root then
- print("Neked ez a jog tiltva van!: "..jog) jog = nil sleep(1)
- end
- else
- print("rossz gomb!") sleep(1)
- end
- if jog ~= nil then
- print("mire allitsam? 1 = igen / 2 = nem")
- event, key = os.pullEvent("key")
- if key == 79 then -- igaz kimenet
- print("valasztott jog: ", jog) sleep(1)
- if jog == "adminjog" then
- adminjog = "true"
- elseif jog == "doors" then
- doors = "true"
- elseif jog == "windows" then
- windows = "true"
- elseif jog == "perm" then
- perm = "true"
- elseif jog == "create" then
- create = "true"
- elseif jog == "delete" then
- delete = "true"
- end
- elseif key == 80 then -- hamis kimenet
- if jog == "adminjog" then
- adminjog = "false"
- elseif jog == "doors" then
- doors = "false"
- elseif jog == "windows" then
- windows = "false"
- elseif jog == "perm" then
- perm = "false"
- elseif jog == "create" then
- create = "false"
- elseif jog == "delete" then
- delete = "false"
- end
- else
- print("rossz gomb") sleep(1) what = 0
- seljog = nil
- end
- seljog = nil
- end
- if oldusername == username then
- storepermissions()
- end
- datawrite()
- else
- print("rossz jelszo") sleep(1)
- end
- else
- print("rossz jelszo") sleep(1)
- end
- -- print("username: ", username) print("goodpass: ", goodpass) print("adminjog: ", adminjog)
- -- print("doors: ", doors) print("windows: ", windows) print("perm: ", perm) print("delete: ", delete)
- -- loads()
- else
- print("ning jogod hozza") sleep(1)
- end
- restorepermissions()
- end
- function deleteuser()
- if delete == "true" then
- clear() print(lang3)
- passhashcheck = read("*")
- passhashcheck2 = tostring(StringHash(passhashcheck))
- if passhashcheck2 == goodpass then
- clear() print(lang3, " ", lang16)
- sleep(1)
- print(lang4..lang19)
- deleteuser = read()
- if not fs.exists("database/"..deleteuser) then
- print(lang4, "not found")
- sleep(.4)
- elseif deleteuser == username then
- print(username)
- print("nem torolheted sajat magad")
- sleep(1)
- elseif deleteuser == "root" then
- print("Root felhasznalot nem torolhetsz")
- sleep(1)
- else
- print("user found")
- print("confirm delete i/n")
- del = read()
- if del == "" then
- print("csak i vagy n") sleep(1)
- elseif del == "i" or del == "I" then
- fs.delete("database/"..deleteuser)
- elseif del == "n" or del == "N" then
- print("delete canceled")
- else
- print("button wrong")
- end
- end
- else
- print(lang3, " ", lang20) sleep(1)
- end
- else
- print("You don't have enough permission") sleep(1)
- end
- end
- function shutdown()
- os.shutdown()
- end
- function logout()
- selectedItem = 1
- selectedMenu = 1
- end
- function loads()
- file = fs.open("database/"..username, "r")
- goodpass = file.readLine()
- adminjog = file.readLine()
- doors = file.readLine()
- windows = file.readLine()
- perm = file.readLine()
- create = file.readLine()
- delete = file.readLine()
- file.close()
- end
- function datawrite()
- file = fs.open("database/"..username, "w")
- file.writeLine(goodpass)
- file.writeLine(adminjog)
- file.writeLine(doors)
- file.writeLine(windows)
- file.writeLine(perm)
- file.writeLine(create)
- file.writeLine(delete)
- file.close()
- end
- function doorsopen()
- clear()
- if doors == "true" then
- print("ajtok nyitva")
- rs.setOutput("right", true)
- sleep(6)
- rs.setOutput("right", false)
- end
- if doors == "false" then
- print("You don't have enough permission")
- sleep(1)
- end
- end
- function windowsopen()
- clear()
- if windows == "true" then
- print("ablakok nyitva")
- sleep(1)
- end
- if windows == "false" then
- print("You don't have enough permission")
- sleep(1)
- end
- end
- function programstops()
- for i = 1, #unlock do
- tabla = unlock[i]
- matrix2 = matrix1..tabla
- matrix1 = matrix2
- end
- if matrix2 == "221" then
- print("sikeres") sleep(.4)
- running = false
- else
- print("sikertelen") sleep(.4)
- end
- for i = 1, #unlock do
- table.remove(unlock)
- end
- index = 1
- matrix1 = ""
- matrix2 = ""
- end
- local mainMenu1 = {
- [1] = { text = lang1, handler = login },
- [2] = { text = lang12, handler = english },
- [3] = { text = lang14, handler = deutsch },
- [4] = { text = lang13, handler = magyar },
- [5] = { text = lang2, handler = shutdown }
- }
- local mainMenu2 = {
- [1] = { text = lang17.. " " ..lang3, handler = changepassword },
- [2] = { text = lang17.. " " ..lang4, handler = createuser },
- [3] = { text = lang5, handler = alluser },
- [4] = { text = lang6, handler = permissions },
- [5] = { text = lang7, handler = deleteuser },
- [6] = { text = lang8, handler = logout },
- [7] = { text = lang9, handler = doorsopen },
- [8] = { text = lang10, handler = windowsopen },
- [9] = { text = lang11, handler = programstops },
- [10] = { text = lang2, handler = shutdown }
- }
- local mainMenu3 = {
- [1] = { text = lang3, handler = changepassword },
- [2] = { text = lang9, handler = doorsopen },
- [3] = { text = lang10, handler = windowsopen },
- [4] = { text = lang8, handler = logout }
- }
- function printMenu( menu )
- term.setCursorPos(width - 48, height)
- print("Bejelentkezve: ", username)
- if #menu < height - 1 then
- for i=1,#menu do
- if i < height - 1 then
- if i == selectedItem then
- term.setCursorPos(width/3 - 2, (i))
- print(">> "..menu[i].text .. " <<")
- else
- term.setCursorPos(width/3 - 2, (i))
- print(" "..menu[i].text)
- end
- end
- end
- elseif #menu >= height - 1 then
- for i=1, #menu do
- if i < height - 1 then
- if i == selectedItem then
- term.setCursorPos(width + 4 - width, (i))
- print(">> "..menu[i].text .. " <<")
- else
- term.setCursorPos(width + 4 - width, (i))
- print(" "..menu[i].text)
- end
- elseif i >= height - 1 then
- if i == selectedItem then
- term.setCursorPos(width + 32 - width, (i - height + 2))
- print(">> "..menu[i].text .. " <<")
- else
- term.setCursorPos(width + 32 - width, (i - height + 2))
- print(" "..menu[i].text)
- end
- end
- end
- end
- end
- function keypressprint()
- term.setCursorPos(width - 1, height - 1)
- print("*") sleep(.1) index = index + 1
- term.setCursorPos(width - 1, height - 1)
- print("_")
- sleep(.1)
- end
- function onKeyPressed( key, menu )
- if key == 28 then
- onItemSelected(menu)
- elseif key == 200 then
- if selectedItem > 1 then
- selectedItem = selectedItem - 1
- end
- elseif key == 208 then
- if selectedItem < #menu then
- selectedItem = selectedItem + 1
- end
- elseif key == 203 then
- if selectedItem > 17 then
- selectedItem = selectedItem - 17
- end
- elseif key == 205 then
- vissza = selectedItem
- if selectedItem < #menu then
- selectedItem = selectedItem + 17
- if selectedItem > #menu then
- selectedItem = vissza
- end
- end
- elseif key == 82 then
- table.insert(unlock, index, 0)
- keypressprint()
- elseif key == 79 then
- table.insert(unlock, index, 1)
- keypressprint()
- elseif key == 80 then
- table.insert(unlock, index, 2)
- keypressprint()
- elseif key == 81 then
- table.insert(unlock, index, 3)
- keypressprint()
- elseif key == 75 then
- table.insert(unlock, index, 4)
- keypressprint()
- elseif key == 76 then
- table.insert(unlock, index, 5)
- keypressprint()
- elseif key == 77 then
- table.insert(unlock, index, 6)
- keypressprint()
- elseif key == 71 then
- table.insert(unlock, index, 7)
- keypressprint()
- elseif key == 72 then
- table.insert(unlock, index, 8)
- keypressprint()
- elseif key == 73 then
- table.insert(unlock, index, 9)
- keypressprint()
- end
- end
- function onItemSelected( menu )
- menu[selectedItem].handler()
- end
- function main()
- while running do
- timer()
- clear()
- if selectedMenu == 1 then
- username = nil
- printMenu(mainMenu1)
- event, par1 = os.pullEvent()
- if event == "timer" and par1 == myTimer then
- os.shutdown()
- elseif event == "key" then
- stop = 1
- onKeyPressed(par1, mainMenu1)
- end
- elseif selectedMenu == 2 then
- printMenu(mainMenu2)
- event, par1 = os.pullEvent()
- if event == "timer" and par1 == myTimer then
- selectedItem = 1 selectedMenu = 1 stop = 1
- elseif event == "key" then
- start = 1
- onKeyPressed(par1, mainMenu2)
- end
- elseif selectedMenu == 3 then
- printMenu(mainMenu3)
- event, par1 = os.pullEvent()
- if event == "timer" and par1 == myTimer then
- selectedItem = 1 selectedMenu = 1 stop = 1
- elseif event == "key" then
- start = 1
- onKeyPressed(par1, mainMenu3)
- end
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement