View difference between Paste ID: NkSNmyiT and kmNJcjQU
SHOW: | | - or go back to the newest paste.
1-
rednet.open("front")
1+
--Listing Variables
2-
function checkpass()
2+
sendchan = 4862
3
replchan = 14003
4-
if msg == "lucozade" then
4+
auth = 8246
5-
  rednet.send(id, "yes")
5+
accept = "AuthAccept"
6
denied = "NoBall"
7-
elseif msg == "su25tmflanker" then
7+
8-
  rednet.send(id, "yes")
8+
--Modem Detection
9-
elseif msg == "DGM01" then
9+
for a,b in pairs(rs.getSides()) do
10-
  rednet.send(id, "yes")
10+
  if peripheral.getType(b) == 'modem' then
11-
  
11+
   m = peripheral.wrap(b)
12-
else
12+
   m.open(sendchan)
13-
  print ("wrong")
13+
   m.open(replchan)
14
   break
15
  end
16
end
17
18-
--PROGRAM START
18+
--Functions
19
function modtran(type)
20-
id,msg=rednet.receive()
20+
  if type == "a" then
21-
checkpass()
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