Posted 23 April 2014 - 08:28 PM
rednet.open("top")
local Status = {}
function Lockdown()
rednet.send(25, "Lock", "Security")
rednet.send(11, "Lock", "Security")
rednet.send(13, "Lock", "Security")
Status.Front = "Locked"
Status.Back = "Locked"
Status.Ninja = "Locked"
end
function LockToggle()
if Status[Command] == "Locked" then
rednet.send(ComControl[Command], "Open", "Security")
Status[Command] = "Unlocked"
rednet.send(ID, Status[Command])
elseif Status[Command] == "Unlocked" then
rednet.send(ComControl[Command], "Lock", "Security")
Status[Command] = "Locked"
rednet.send(ID, Status[Command])
end
end
local Access = {
Jewel = "Alpha01",
Admin = "AdminCode"
}
local AccessLevel = {
Jewel = "1",
Admin = "1"
}
local ComControl = {
Front = "13",
Back = "11",
Ninja = "25"
}
local Status = {}
Lockdown()
while true do
ID, User, Pass = rednet.receive()
if Access[User] == Pass then
rednet.send(ID, "Access Level "..AccessLevel[User].." granted.", 0)
sleep(0.1)
rednet.send(ID, "Please Enter Command:")
ID, Command = rednet.receive()
if Command == "Lockdown" then
Lockdown()
rednet.send(ID, "Facility on Level 1 Lockdown.")
while true do
ID, User, Pass = rednet.receive()
if Access[User] == Pass then
rednet.send(ID, "Lockdown Lifted.")
break
else
rednet.send(ID, "Error")
end
end
elseif Command == "Front" or Command == "Back" or Command == "Ninja" then
LockToggle()
else
rednet.send(ID, "INVALID COMMAND")
end
else
rednet.send(ID, "Invalid User/Pass")
end
end
The error keeps coming up at line 16 every time I try to have it run that function.