thatsimplekid

Server

Jan 26th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. --   CODED AND DESIGNED BY OWEN FLAHERTY AKA thatsimplekid
  2. --   ORIGINAL IDEA BY ANTONY DUERDOTH AKA Anteater46
  3. --   MAIN TESTERS, Mattz83, Anteater46, thatsimplekid
  4. --   ALL CREDIT Goes To The Creator(OWEN FLAHERTY) of this program
  5. --   ALL RIGHTS RESERVED
  6. --
  7. --   DONT STEAL THIS CODE
  8. --   YOU ARE ALLOWED TO REDISTRIBUTE (ONLY UNMODIFIED), BUT THIS BANNER MUST NOT BE  REMOVED
  9. while true do
  10. n = 0
  11. a = 0
  12. term.clear()
  13. term.setCursorPos(1,1)
  14. print("ANT N CO Banking Server v0.1")
  15. rednet.open("back")
  16. rednet.open("top")rednet.open("bottom")
  17. rednet.open("left")
  18. rednet.open("right")
  19. if fs.exists(".database") then
  20.  local file = fs.open(".database","r")
  21.  local database = textutils.unserialize(file.readAll())
  22.  file.close()
  23. else
  24.  local database = {
  25.   ["ANTNCO"] = {
  26.     pin = 1234;
  27.     balance = 500000;
  28.   };
  29.   ["thatsimplekid"] = {
  30.     pin = 8080;
  31.     balance = 25000;
  32.   };
  33.  }
  34.  local file = fs.open(".database","w")
  35.  file.write(textutils.serialize(database))
  36.  file.close()
  37.  os.reboot()
  38. end
  39.  
  40. --[Now Time For The ACTUAL Banking System]--
  41. id, msg = rednet.receive()
  42.  
  43. if msg == "addrem"then
  44.  rednet.send(id, "IGN")
  45.  idd,msgg = rednet.receive()
  46.  ign = msgg
  47.  if idd==id then
  48.   rednet.send(idd, "AMT")
  49.   iddd,msggg = rednet.receive()
  50.   amount = tonumber(msggg)
  51.   dmsgb = tonumber(database[ign].balance)
  52.   abcde = database[ign].balance
  53.   abcde = dmsgb - amount
  54.   print(msgg .. " - " .. dmsgb)
  55.  end
  56. end
  57.  
  58. end
Advertisement
Add Comment
Please, Sign In to add comment