Advertisement
Simlor_GER

SimSoft 4 - AcManager

Jul 6th, 2016
1,618
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.03 KB | None | 0 0
  1. --Copyright Simlor (http://www.computercraft.info/forums2/index.php?/user/55655-simlor/) - Alle Rechte an diesen Programm sind Simlor vorbehalten.
  2.  
  3. --AcManager
  4.  
  5. backD = false
  6. AC = 0
  7.  
  8. while true do
  9.  
  10. Rechte()
  11.  
  12. file = fs.open("SimSoft/Data/Config","r")
  13. local fileData = {}
  14. local line = file.readLine()
  15. repeat
  16. table.insert(fileData,line)
  17. line = file.readLine()
  18. until line == nil
  19. file.close()
  20.  
  21. PassSOO = fileData[1]
  22. Hintergrund = fileData[2]
  23. Version = fileData[3]
  24. Sprache = fileData[4]
  25. --
  26. file = fs.open("SimSoft/Data/User/User1","r")
  27. local fileData = {}
  28. local line = file.readLine()
  29. repeat
  30. table.insert(fileData,line)
  31. line = file.readLine()
  32. until line == nil
  33. file.close()
  34.  
  35. u1 = fileData[1]
  36. p1 = fileData[2]
  37. --
  38. file = fs.open("SimSoft/Data/User/User2","r")
  39. local fileData = {}
  40. local line = file.readLine()
  41. repeat
  42. table.insert(fileData,line)
  43. line = file.readLine()
  44. until line == nil
  45. file.close()
  46.  
  47. u2 = fileData[1]
  48. p2 = fileData[2]
  49. ACTF2 = fileData[3]
  50. --
  51. file = fs.open("SimSoft/Data/User/User3","r")
  52. local fileData = {}
  53. local line = file.readLine()
  54. repeat
  55. table.insert(fileData,line)
  56. line = file.readLine()
  57. until line == nil
  58. file.close()
  59.  
  60. u3 = fileData[1]
  61. p3 = fileData[2]
  62. ACTF3 = fileData[3]
  63. --
  64.  
  65. BC(256)
  66. Clear()
  67.  
  68. SimSoftBalken("SimSoft 4 - AcManager", 21)
  69.  
  70. BC(256)
  71.  
  72. w, h = term.getSize()
  73.  
  74. wa = (w-6)
  75.  
  76. CP(wa,5)
  77. TC(32)
  78. if Recht == "Guest" then
  79. recht = " User"
  80. elseif Recht == "Admin" then
  81. recht = "Admin"
  82. end
  83. print(recht)
  84.  
  85. if AC == 0 then
  86. BC(256)
  87. CP(1,6)
  88. print(" ")
  89. print(" ")
  90. print(" ")
  91. print(" ")
  92. print(" ")
  93. print(" ")
  94. print(" ")
  95. print(" ")
  96. print(" ")
  97. print(" ")
  98.  
  99. BC(256)
  100. TC(1)
  101. CP(3,6)
  102. print(" Choose an account ")
  103.  
  104.  
  105. w, h = term.getSize()
  106. h = (h-1)
  107. BC(256)
  108. TC(1)
  109. CP(3,h)
  110. print("Desktop")
  111.  
  112. while true do
  113. event,side,x,y = os.pullEvent()
  114. if event == "mouse_click" then
  115.  
  116. if x >= 3 and x <= 9 and y == h then
  117. backD = true
  118. break
  119. end
  120.  
  121. if x >= 3 and x <= 21 and y == 6 then
  122. TC(1)
  123. CP(3,6)
  124. BC(8)
  125. print(" Choose an account ")
  126. TC(8)
  127. BC(1)
  128. CP(3,7)
  129. print(" ")
  130. TC(1)
  131. BC(8)
  132. CP(3,8)
  133. print(" Account 1 - Adm. ")
  134. TC(8)
  135. BC(1)
  136. CP(3,9)
  137. print(" Account 2 ")
  138. TC(1)
  139. BC(8)
  140. CP(3,10)
  141. print(" Account 3 ")
  142.  
  143. while true do
  144. event,side,x,y = os.pullEvent()
  145. if event == "mouse_click" then
  146.  
  147. if x >= 3 and x <= 21 and y == 8 then
  148. AC = 1
  149. break
  150. elseif x >= 3 and x <= 21 and y == 9 then
  151. AC = 2
  152. break
  153. elseif x >= 3 and x <= 21 and y == 10 then
  154. AC = 3
  155. break
  156. elseif x >= 3 and x <= 21 and y >= 11 and y <= 19 or x >= 1 and x <= 51 and y >= 1 and y <= 5 or x >= 1 and x <= 2 and y >= 1 and y <= 19 or x >= 22 and x <= 51 and y >= 1 and y <= 19 then
  157. AC = 0
  158. break
  159. end
  160. end
  161. end
  162. end
  163. break
  164. end
  165. end
  166.  
  167. elseif AC == 1 then
  168. BC(256)
  169. CP(1,6)
  170. print(" ")
  171. print(" ")
  172. print(" ")
  173. print(" ")
  174. print(" ")
  175. print(" ")
  176. print(" ")
  177. print(" ")
  178. print(" ")
  179. print(" ")
  180.  
  181. BC(256)
  182. TC(1)
  183. CP(3,6)
  184. print(" Account 1 - Admin ")
  185.  
  186. w, h = term.getSize()
  187. h = (h-1)
  188. BC(256)
  189. TC(1)
  190. CP(3,h)
  191. print("Desktop")
  192.  
  193. BC(256)
  194. TC(1)
  195. CP(4,9)
  196. write("Edit name")
  197. TC(128)
  198. print(" - "..u1)
  199.  
  200. BC(256)
  201. TC(1)
  202. CP(4,11)
  203. write("Edit password")
  204. TC(128)
  205. print(" - ******")
  206.  
  207. CP(4, 13)
  208. BC(256)
  209. TC(128)
  210. print("Login on/off")
  211.  
  212. if PassSOO == "true" then
  213. CP(18,13)
  214. if Recht == "Admin" then
  215. BC(8)
  216. write(" ")
  217. BC(32768)
  218. print(" ")
  219. else
  220. BC(16384)
  221. write(" ")
  222. BC(32768)
  223. print(" ")
  224. end
  225. else
  226. CP(18,13)
  227. if Recht == "Admin" then
  228. BC(32768)
  229. write(" ")
  230. BC(128)
  231. print(" ")
  232. else
  233. BC(32768)
  234. write(" ")
  235. BC(16384)
  236. print(" ")
  237. end
  238. end
  239.  
  240. while true do
  241. event,side,x,y = os.pullEvent()
  242. if event == "mouse_click" then
  243.  
  244. if x >= 18 and x <= 20 and y == 13 then
  245. if Recht == "Admin" then
  246. if PassSOO == "true" then
  247. PassSOO = "false"
  248. else
  249. PassSOO = "true"
  250. end
  251.  
  252. local file = fs.open("SimSoft/Data/Config","w")
  253. file.close()
  254. local file = fs.open("SimSoft/Data/Config","w")
  255. file.writeLine(PassSOO)
  256. file.writeLine(Hintergrund)
  257. file.writeLine(Version)
  258. file.writeLine(Sprache)
  259. file.close()
  260. end
  261. end
  262.  
  263. if x >= 3 and x <= 9 and y == h then
  264. backD = true
  265. break
  266. end
  267.  
  268. if x >= 4 and x <= 12 and y == 9 then
  269.  
  270. if Recht == "Admin" then
  271. BC(256)
  272. CP(16,9)
  273. TC(128)
  274. print(" ")
  275. CP(16,9)
  276. nname = read()
  277.  
  278. local file = fs.open("SimSoft/Data/User/User1","w")
  279. file.close()
  280. local file = fs.open("SimSoft/Data/User/User1","w")
  281. file.writeLine(nname)
  282. file.writeLine(p1)
  283. file.close()
  284. CP(16,9)
  285. TC(32)
  286. print("Saved!")
  287. sleep(0.2)
  288. break
  289. else
  290. CP(16,9)
  291. BC(256)
  292. TC(16384)
  293. print("You are not a admin ")
  294. sleep(1)
  295. break
  296. end
  297. end
  298.  
  299. if x >= 4 and x <= 16 and y == 11 then
  300.  
  301. if Recht == "Admin" then
  302. BC(256)
  303. CP(20,11)
  304. TC(128)
  305. print(" ")
  306. CP(20,11)
  307. npass = read("*")
  308.  
  309. local file = fs.open("SimSoft/Data/User/User1","w")
  310. file.close()
  311. local file = fs.open("SimSoft/Data/User/User1","w")
  312. file.writeLine(u1)
  313. file.writeLine(npass)
  314. file.close()
  315. CP(20,11)
  316. TC(32)
  317. print("Saved! ")
  318. sleep(0.2)
  319. break
  320. else
  321. CP(20,11)
  322. BC(256)
  323. TC(16384)
  324. print("You are not a admin ")
  325. sleep(1)
  326. break
  327. end
  328. end
  329.  
  330.  
  331. if x >= 3 and x <= 21 and y == 6 then
  332. TC(1)
  333. CP(3,6)
  334. BC(8)
  335. print(" Choose an account ")
  336. TC(8)
  337. BC(1)
  338. CP(3,7)
  339. print(" ")
  340. TC(1)
  341. BC(8)
  342. CP(3,8)
  343. print(" Account 1 - Adm. ")
  344. TC(8)
  345. BC(1)
  346. CP(3,9)
  347. print(" Account 2 ")
  348. TC(1)
  349. BC(8)
  350. CP(3,10)
  351. print(" Account 3 ")
  352.  
  353. while true do
  354. event,side,x,y = os.pullEvent()
  355. if event == "mouse_click" then
  356.  
  357. if x >= 3 and x <= 21 and y == 8 then
  358. AC = 1
  359. break
  360. elseif x >= 3 and x <= 21 and y == 9 then
  361. AC = 2
  362. break
  363. elseif x >= 3 and x <= 21 and y == 10 then
  364. AC = 3
  365. break
  366. elseif x >= 3 and x <= 21 and y >= 11 and y <= 19 or x >= 1 and x <= 51 and y >= 1 and y <= 5 or x >= 1 and x <= 2 and y >= 1 and y <= 19 or x >= 22 and x <= 51 and y >= 1 and y <= 19 then
  367. AC = 1
  368. break
  369. end
  370. end
  371. end
  372. end
  373. break
  374. end
  375. end
  376.  
  377. elseif AC == 2 then
  378. BC(256)
  379. CP(1,6)
  380. print(" ")
  381. print(" ")
  382. print(" ")
  383. print(" ")
  384. print(" ")
  385. print(" ")
  386. print(" ")
  387. print(" ")
  388. print(" ")
  389. print(" ")
  390.  
  391. BC(256)
  392. TC(1)
  393. CP(3,6)
  394. print(" Account 2 ")
  395.  
  396. w, h = term.getSize()
  397. h = (h-1)
  398. BC(256)
  399. TC(1)
  400. CP(3,h)
  401. print("Desktop")
  402.  
  403. BC(256)
  404. TC(1)
  405. CP(4,9)
  406. write("Edit name")
  407. TC(128)
  408. print(" - "..u2)
  409.  
  410. BC(256)
  411. TC(1)
  412. CP(4,11)
  413. write("Edit password")
  414. TC(128)
  415. print(" - ******")
  416.  
  417. if ACTF2 == "true" then
  418. CP(15,6)
  419. if Recht == "Admin" then
  420. BC(8)
  421. write(" ")
  422. BC(32768)
  423. print(" ")
  424. else
  425. BC(16384)
  426. write(" ")
  427. BC(32768)
  428. print(" ")
  429. end
  430. else
  431. CP(15,6)
  432. if Recht == "Admin" then
  433. BC(32768)
  434. write(" ")
  435. BC(128)
  436. print(" ")
  437. else
  438. BC(32768)
  439. write(" ")
  440. BC(16384)
  441. print(" ")
  442. end
  443. end
  444.  
  445. while true do
  446. event,side,x,y = os.pullEvent()
  447. if event == "mouse_click" then
  448.  
  449. if x >= 15 and x <= 17 and y == 6 then
  450. if Recht == "Admin" then
  451. if ACTF2 == "true" then
  452. ACTF2 = "false"
  453. else
  454. ACTF2 = "true"
  455. end
  456.  
  457. local file = fs.open("SimSoft/Data/User/User2","w")
  458. file.close()
  459. local file = fs.open("SimSoft/Data/User/User2","w")
  460. file.writeLine(u2)
  461. file.writeLine(p2)
  462. file.writeLine(ACTF2)
  463. file.close()
  464. end
  465. end
  466.  
  467. if x >= 3 and x <= 9 and y == h then
  468. backD = true
  469. break
  470. end
  471.  
  472. if x >= 4 and x <= 12 and y == 9 then
  473.  
  474. if Recht == "Admin" or RechtH == 2 then
  475. BC(256)
  476. CP(16,9)
  477. TC(128)
  478. print(" ")
  479. CP(16,9)
  480. nname = read()
  481.  
  482. local file = fs.open("SimSoft/Data/User/User2","w")
  483. file.close()
  484. local file = fs.open("SimSoft/Data/User/User2","w")
  485. file.writeLine(nname)
  486. file.writeLine(p2)
  487. file.writeLine(ACTF2)
  488. file.close()
  489. CP(16,9)
  490. TC(32)
  491. print("Saved! ")
  492. sleep(0.2)
  493. break
  494. else
  495. CP(16,9)
  496. BC(256)
  497. TC(16384)
  498. print("You are not user 2 ")
  499. sleep(1)
  500. break
  501. end
  502. end
  503.  
  504. if x >= 4 and x <= 16 and y == 11 then
  505.  
  506. if Recht == "Admin" or RechtH == 2 then
  507. BC(256)
  508. CP(20,11)
  509. TC(128)
  510. print(" ")
  511. CP(20,11)
  512. npass = read("*")
  513.  
  514. local file = fs.open("SimSoft/Data/User/User2","w")
  515. file.close()
  516. local file = fs.open("SimSoft/Data/User/User2","w")
  517. file.writeLine(u2)
  518. file.writeLine(npass)
  519. file.writeLine(ACTF2)
  520. file.close()
  521. CP(20,11)
  522. TC(32)
  523. print("Saved! ")
  524. sleep(0.2)
  525. break
  526. else
  527. CP(20,11)
  528. BC(256)
  529. TC(16384)
  530. print("You are not user 2 ")
  531. sleep(1)
  532. break
  533. end
  534. end
  535.  
  536.  
  537. if x >= 3 and x <= 13 and y == 6 then
  538. TC(1)
  539. CP(3,6)
  540. BC(8)
  541. print(" Choose an account ")
  542. TC(8)
  543. BC(1)
  544. CP(3,7)
  545. print(" ")
  546. TC(1)
  547. BC(8)
  548. CP(3,8)
  549. print(" Account 1 - Adm. ")
  550. TC(8)
  551. BC(1)
  552. CP(3,9)
  553. print(" Account 2 ")
  554. TC(1)
  555. BC(8)
  556. CP(3,10)
  557. print(" Account 3 ")
  558.  
  559. while true do
  560. event,side,x,y = os.pullEvent()
  561. if event == "mouse_click" then
  562.  
  563. if x >= 3 and x <= 21 and y == 8 then
  564. AC = 1
  565. break
  566. elseif x >= 3 and x <= 21 and y == 9 then
  567. AC = 2
  568. break
  569. elseif x >= 3 and x <= 21 and y == 10 then
  570. AC = 3
  571. break
  572. elseif x >= 3 and x <= 21 and y >= 11 and y <= 19 or x >= 1 and x <= 51 and y >= 1 and y <= 5 or x >= 1 and x <= 2 and y >= 1 and y <= 19 or x >= 22 and x <= 51 and y >= 1 and y <= 19 then
  573. AC = 2
  574. break
  575. end
  576. end
  577. end
  578. end
  579. break
  580. end
  581. end
  582.  
  583. elseif AC == 3 then
  584. BC(256)
  585. CP(1,6)
  586. print(" ")
  587. print(" ")
  588. print(" ")
  589. print(" ")
  590. print(" ")
  591. print(" ")
  592. print(" ")
  593. print(" ")
  594. print(" ")
  595. print(" ")
  596. print(" ")
  597. print(" ")
  598.  
  599. BC(256)
  600. TC(1)
  601. CP(3,6)
  602. print(" Account 3 ")
  603.  
  604. w, h = term.getSize()
  605. h = (h-1)
  606. BC(256)
  607. TC(1)
  608. CP(3,h)
  609. print("Desktop")
  610.  
  611. BC(256)
  612. TC(1)
  613. CP(4,9)
  614. write("Edit name")
  615. TC(128)
  616. print(" - "..u3)
  617.  
  618. BC(256)
  619. TC(1)
  620. CP(4,11)
  621. write("Edit password")
  622. TC(128)
  623. print(" - ******")
  624.  
  625. if ACTF3 == "true" then
  626. CP(15,6)
  627. if Recht == "Admin" then
  628. BC(8)
  629. write(" ")
  630. BC(32768)
  631. print(" ")
  632. else
  633. BC(16384)
  634. write(" ")
  635. BC(32768)
  636. print(" ")
  637. end
  638. else
  639. CP(15,6)
  640. if Recht == "Admin" then
  641. BC(32768)
  642. write(" ")
  643. BC(128)
  644. print(" ")
  645. else
  646. BC(32768)
  647. write(" ")
  648. BC(16384)
  649. print(" ")
  650. end
  651. end
  652.  
  653. while true do
  654. event,side,x,y = os.pullEvent()
  655. if event == "mouse_click" then
  656.  
  657. if x >= 15 and x <= 17 and y == 6 then
  658. if Recht == "Admin" then
  659. if ACTF3 == "true" then
  660. ACTF3 = "false"
  661. else
  662. ACTF3 = "true"
  663. end
  664.  
  665. local file = fs.open("SimSoft/Data/User/User3","w")
  666. file.close()
  667. local file = fs.open("SimSoft/Data/User/User3","w")
  668. file.writeLine(u3)
  669. file.writeLine(p3)
  670. file.writeLine(ACTF3)
  671. file.close()
  672. end
  673. end
  674.  
  675. if x >= 3 and x <= 9 and y == h then
  676. backD = true
  677. break
  678. end
  679.  
  680. if x >= 4 and x <= 12 and y == 9 then
  681.  
  682. if Recht == "Admin" or RechtH == 3 then
  683. BC(256)
  684. CP(16,9)
  685. TC(128)
  686. print(" ")
  687. CP(16,9)
  688. nname = read()
  689.  
  690. local file = fs.open("SimSoft/Data/User/User3","w")
  691. file.close()
  692. local file = fs.open("SimSoft/Data/User/User3","w")
  693. file.writeLine(nname)
  694. file.writeLine(p3)
  695. file.writeLine(ACTF3)
  696. file.close()
  697. CP(16,9)
  698. TC(32)
  699. print("Saved! ")
  700. sleep(0.2)
  701. break
  702. else
  703. CP(16,9)
  704. BC(256)
  705. TC(16384)
  706. print("You are not user 3 ")
  707. sleep(1)
  708. break
  709. end
  710. end
  711.  
  712. if x >= 4 and x <= 16 and y == 11 then
  713.  
  714. if Recht == "Admin" or RechtH == 3 then
  715. BC(256)
  716. CP(20,11)
  717. TC(128)
  718. print(" ")
  719. CP(20,11)
  720. npass = read("*")
  721.  
  722. local file = fs.open("SimSoft/Data/User/User3","w")
  723. file.close()
  724. local file = fs.open("SimSoft/Data/User/User3","w")
  725. file.writeLine(u3)
  726. file.writeLine(npass)
  727. file.writeLine(ACTF3)
  728. file.close()
  729. CP(20,11)
  730. TC(32)
  731. print("Saved! ")
  732. sleep(0.2)
  733. break
  734. else
  735. CP(20,11)
  736. BC(256)
  737. TC(16384)
  738. print("You are not user 3 ")
  739. sleep(1)
  740. break
  741. end
  742. end
  743.  
  744.  
  745. if x >= 3 and x <= 13 and y == 6 then
  746. TC(1)
  747. CP(3,6)
  748. BC(8)
  749. print(" Choose an account ")
  750. TC(8)
  751. BC(1)
  752. CP(3,7)
  753. print(" ")
  754. TC(1)
  755. BC(8)
  756. CP(3,8)
  757. print(" Account 1 - Adm. ")
  758. TC(8)
  759. BC(1)
  760. CP(3,9)
  761. print(" Account 2 ")
  762. TC(1)
  763. BC(8)
  764. CP(3,10)
  765. print(" Account 3 ")
  766.  
  767. while true do
  768. event,side,x,y = os.pullEvent()
  769. if event == "mouse_click" then
  770.  
  771. if x >= 3 and x <= 21 and y == 8 then
  772. AC = 1
  773. break
  774. elseif x >= 3 and x <= 21 and y == 9 then
  775. AC = 2
  776. break
  777. elseif x >= 3 and x <= 21 and y == 10 then
  778. AC = 3
  779. break
  780. elseif x >= 3 and x <= 21 and y >= 11 and y <= 19 or x >= 1 and x <= 51 and y >= 1 and y <= 5 or x >= 1 and x <= 2 and y >= 1 and y <= 19 or x >= 22 and x <= 51 and y >= 1 and y <= 19 then
  781. AC = 3
  782. break
  783. end
  784. end
  785. end
  786. end
  787. break
  788. end
  789. end
  790. end
  791. if backD == true then
  792. break
  793. end
  794. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement