LDShadowLord

MagLogServer

Sep 14th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Listing Variables
  2. sendchan = 4862
  3. replchan = 14003
  4. auth = 8246
  5. accept = "AuthAccept"
  6. denied = "NoBall"
  7.  
  8. --Modem Detection
  9. for a,b in pairs(rs.getSides()) do
  10.   if peripheral.getType(b) == 'modem' then
  11.    m = peripheral.wrap(b)
  12.    m.open(sendchan)
  13.    m.open(replchan)
  14.    break
  15.   end
  16. end
  17.  
  18. --Functions
  19. function modtran(type)
  20.   if type == "a" then
  21.     m.transmit(sendchan, auth, accept)
  22.   elseif type == "d" then
  23.     m.transmit(sendchan, auth, denied)
  24.   end
  25. end
  26.  
  27. function PassCheck()
  28.   local event, nil1, id, replyChannel, msg, nil2 = os.pullEvent("modem_message")
  29.   if msg == "lucozade" then
  30.     modtran(a)
  31.     print("Connection Accepted")
  32.   elseif msg == "su25tmflanker" then
  33.     modtran(a)
  34.     print("Connection Accepted")
  35.   elseif msg == "dgm10" then
  36.     modtran(a)
  37.     print("Connection Accepted")
  38.   else
  39.     modtran(d)
  40.     print("Connection Refused")
  41.   end
  42. end
  43.  
  44.  
  45. --Main Program
  46. while true do
  47.   PassCheck()
  48. end
Advertisement
Add Comment
Please, Sign In to add comment