Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os_pullEvent = os.pullEvent
- os.pullEvent = os.pullEventRaw
- local pd = peripheral.find("player_detector")
- local w,h = term.getSize()
- local welcome = {
- "Welcome to",
- "InputUsername's computer.",
- "",
- "Please identify yourself.",
- }
- local access = {
- "Access granted.",
- "Hello, %s.",
- }
- local noaccess = {
- "Access denied.",
- "Nice try, %s.",
- }
- local whitelist = {
- ["InputUsername"] = true,
- ["Lollonator"] = true,
- ["valithor2"] = true,
- }
- term.setBackgroundColor(colors.white)
- while true do
- term.setTextColor(colors.lightGray)
- term.clear()
- for i=1,#welcome do
- term.setCursorPos(w/2-#welcome[i]/2+1,h/2-#welcome/2-1+i)
- textutils.slowPrint(welcome[i],25)
- end
- local e,_,p = os.pullEvent("player")
- if (whitelist[p] == true) then
- sleep(.5)
- term.setTextColor(colors.black)
- for i=1,#access do
- local s = access[i]:format(p)
- term.setCursorPos(w/2-#s/2+1,h/2+#welcome/2+1+i)
- textutils.slowPrint(s)
- end
- sleep(.5)
- break
- else
- sleep(.5)
- term.setTextColor(colors.black)
- for i=1,#noaccess do
- local s = noaccess[i]:format(p)
- term.setCursorPos(w/2-#s/2+1,h/2+#welcome/2+1+i)
- textutils.slowPrint(s)
- end
- end
- end
- term.setBackgroundColor(colors.black)
- term.setCursorPos(1,1)
- term.clear()
- os.pullEvent = os_pullEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement