I have a tunnel system which has several bulkheads which close when I issue their closure through a PDA, although I want a alarm that detects intruders and send the signal to the master computer, I can handle the rednet stuff if someone can help me code a device to check who the sensor detects, I'm playing the mindcrack crackpack and I think the sensor is from opens peripherals addon... I don't know where to start
I understand this isn't somewhere for people to give code but your time will be greatly appreciated.
Sensor Alarm
Started by hbomb79, Jun 30 2014 02:24 AM
4 replies to this topic
#1
Posted 30 June 2014 - 02:24 AM
#2
Posted 30 June 2014 - 02:33 AM
You'll first want to determine how to use the peripheral. This guide should teach you how to figure that out.
If the device is a recentish OpenPeripheral block, you may also be able to get further information about the commands it grants you by entering into the prompt:
If the device is a recentish OpenPeripheral block, you may also be able to get further information about the commands it grants you by entering into the prompt:
openp/docs <side> <methodname>
#3
Posted 30 June 2014 - 05:34 AM
... That doesnt help, I know how to use peripherals its just the tables and stuff i dont understand
#5
Posted 30 June 2014 - 09:24 AM
You can use sensor.getPlayerNames() (Ofcourse sensor. would be your wrap for the peripheral)
This will reutrn a table of all people withing sensor range. Then this way you can loop through them:
This will reutrn a table of all people withing sensor range. Then this way you can loop through them:
for i,player in pairs(sensor.getPlayerNames) do endThen to check whether or not he is an intruder you could set up a whitelist using a table
whitelist={
["playerName"]=true,
["anoterName"]=true,
["nameyName"]=true,
}
function checkPlayers()
for id,player in pairs(sensor.getPlayerNames) do
if not whitelist[player] then
--Your code to sound the alarm
end
end
end
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











