Guest User

startup

a guest
Sep 25th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1. local pfpChans = {"5678"}
  2. local ftaChans = {}
  3. local subIDs = {"0000001"}
  4. term.clear()
  5. term.setCursorPos(1,1)
  6. print("FunRide Broadcasting Subscription/Free to Air Encryption")
  7. print("This computer's ID is: "..os.getComputerID())
  8. local modem = peripheral.find("modem")
  9. if not modem then
  10.   print("Modem required!")
  11.   return
  12. end
  13. modem.open(5555)
  14.  
  15. while true do
  16.   e = {os.pullEvent()}
  17.   if e[1] == "modem_message" and e[3] == 5555 and e[5]:sub(1,17) == "request_subscrip_" then
  18.     print("Someone just requested subscription")
  19.     id2 = e[5]:gsub("request_subscrip_","")
  20.     id = tonumber(id2)
  21.     for i,v in pairs(pfpChans) do
  22.       if tonumber(v) == id then
  23.         sleep(0.5)
  24.         modem.transmit(5555,id,tostring(id).."_PFP")
  25.         print("They found a matching PFP channel ID!")
  26.       end
  27.     end
  28.     for i,v in pairs(ftaChans) do
  29.       if tonumber(v) == id then
  30.         sleep(0.5)
  31.         modem.transmit(5555,id,tostring(id).."_FTA")
  32.         print("They found a matching FTA channel ID!")
  33.       end
  34.     end
  35.   elseif e[1] == "modem_message" and e[3] == 5555 and e[5]:sub(1,11) == "verify_sub_" then
  36.     print("Someone is verifying their subscription!")
  37.     chan2 = e[5]:gsub("verify_sub_","")
  38.     chan = tonumber(chan2)
  39.     verifyYes = 0
  40.     for i,v in pairs(subIDs) do
  41.       if tonumber(v) == chan then
  42.         sleep(0.5)
  43.         print("Their subscription was found!")
  44.         modem.transmit(5555,e[4],"verify_yes_"..e[4])
  45.         verifyYes = 1
  46.       end
  47.     end
  48.     if verifyYes == 0 then
  49.       sleep(0.5)
  50.       print("They didn't find a subscription D:")
  51.       modem.transmit(555,e[4],"verify_no_"..e[4])
  52.     end
  53.   end
  54. end
Advertisement
Add Comment
Please, Sign In to add comment