Its probably something obvious, but I'm still missing it.. so
Client code-
while true do
local pwresult = " "
local modem = "back"
term.clear()
term.setCursorPos(1,1)
print("Welcome to Cal Co.")
sleep(0.3)
write("Please enter your password: ")
local pw = tostring(read("*"))
term.clear()
term.setCursorPos(1,1)
sleep(0.1)
textutils.slowPrint(".........")
sleep(0.1)
rednet.open( modem)
rednet.send(5, pw)
sleep(0)
pwresult = rednet.receive(8)
term.clear()
term.setCursorPos(1,1)
if pwresult >= 1 then-- change this depending on priority of the door
print("Access granted, please continue.")
rs.setBundledOutput( "right", colors.white)
sleep(2.3)
rs.setBundledOutput( "right", 0)
else
print("Access denied, please try again.")
end
end
Server code-
while true do
local SentPass = "wrong"
local modem = "back"
sleep(0)
rednet.open(modem)
senderId, SentPass = rednet.receive()
local AllowedIds = { 6, 9}
local Passwords = { {name = "pass"}, {name2 = "pass2"}, {name3 = "pass3"}}
if senderId == AllowedIds[1] then
sleep(0)
if SentPass == Passwords[1][name] then
rednet.send( SenderId, 1)
elseif SentPass == Passwords[2][name2] then
rednet.send( SenderId, 2)
elseif SentPass == Passwords[3][name3] then
rednet.send( SenderId, 3)
else
rednet.send( SenderId, 0)
end
else
rednet.send( SenderId, 0)
end
end
It might be something to do with the tables, because I haven't used them before, and they kinda confuse me, except for the rednet part in the error, so idk.
Thank you,