Guest User

Untitled

a guest
Oct 17th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. serverComputer = 16
  2.  
  3. function OpenAll()
  4. for _,side in ipairs(rs.getSides()) do
  5. rednet.open(side)
  6. end
  7. end
  8.  
  9. function split(str, pat)
  10. local t = { }
  11. local fpat = "(.-)"..pat
  12. local last_end = 1
  13. local s, e, cap = str:find(fpat, 1)
  14. while s do
  15. if s ~= 1 or cap ~= "" then
  16. table.insert(t,cap)
  17. end
  18. last_end = e+1
  19. s, e, cap = str:find(fpat, last_end)
  20. end
  21. if last_end <= #str then
  22. cap = str:sub(last_end)
  23. table.insert(t, cap)
  24. end
  25. return t
  26. end
  27.  
  28. function runActivate()
  29. shell.run("clear")
  30. while true do
  31. event, param1 = os.pullEvent()
  32. shell.run("clear")
  33. if event == "disk" then
  34. term.write("Enter Card ID: ")
  35. cardId = tonenumber(read())
  36. path = disk.getMountPath(param1)
  37. rPath = path.."/card"
  38. l = fs.open(rPath, "w")
  39. l.write(cardId)
  40. l.close()
  41. sleep(1)
  42. shell.run("clear")
  43. msg = cardId.."!SP!Activate"
  44. rednet.send(serverComputer, msg)
  45. print("CARD ACTIVATED")
  46. disk.eject(param1)
  47. end
  48. end
  49. end
  50.  
  51. runActivate()
Add Comment
Please, Sign In to add comment