Posted 07 July 2015 - 02:52 PM
                The following script aims to check if a person has clicked a player detector from peripherals++.
i'm trying to print the username of the person clicking the block by returning the statement loginread but it dosen't seem to work. I've asked one of my friends who knows a fair amount about computercraft and he isn't sure either. Thanks :)/>.
                
            i'm trying to print the username of the person clicking the block by returning the statement loginread but it dosen't seem to work. I've asked one of my friends who knows a fair amount about computercraft and he isn't sure either. Thanks :)/>.
--Authentication--
function login_func(loginread)
  reset()
  term.setCursorPos(10,4)
  print("Login")
  setpos2()
  term.write("Username:")
  login_input = read()
  loginread = string.lower(login_input)
  term.clear()
  peripheral.wrap("right")
  setpos1()
  print("Please right click the peripheral")
  local event, players = os.pullEvent( "player" )
  term.clear()
  if players == loginread then
    term.setTextColor(colors.green)
    setpos1()
    textutils.slowPrint("Authentication accepted!")
    sleep(2)
    return loginread
  else
    term.clear()
    setpos1()
    term.setTextColor(colors.red)
    textutils.slowPrint("Authentication denied.")
    sleep(3)
    term.clear()
    login_func()
  end
end   
--Reset balance--
--Create/Read balance accounts--
  
		  
--[Read]--
login_func(loginread)
local loginprint = login_func(loginread)
print(loginprint)
 
        