Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local side = 'back' --Define rednet side
- local IDblack = {6, 7} --All blacklisted IDs
- local black = {'Firewolf', 'DNS'} --All blacklisted messages
- rednet.open(side) --Open rednet
- id, msg = rednet.receive() --Receive the message
- local detected = false --Define a new variable called detected
- print("ID = " .. id)
- print("msg = " .. msg)
- for i=1,#IDblack do --Do the following block of code Length of IDblack times. i stores the current run.
- print("IDBLACK" .. IDblack[i])
- if id == IDblack[i] then --If the current run found that IDblack contains an ID then do the following block of code
- for j=1,#black do --Do the following block of code amount of entries in black times.
- print("black" .. black[j])
- if msg == black[j] then --If current run found that black contains the sent message then
- detected = true --Set detected to true
- print("Detected")
- break --And exit the loop
- end
- end
- end
- if detected == true then
- break
- end
- end
- if detected == true then --Do the alerting only if detected was set to true.
- print('Blocked ID: '..id..' Detected... Denying Access')
- rednet.send(id, 'You Are Blacklisted!')
- end
Advertisement
Add Comment
Please, Sign In to add comment