Advertisement
Guest User

startup

a guest
Dec 14th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.43 KB | None | 0 0
  1. name="user"
  2. function Main()
  3.   local pass = {'not','getting','mypass'}
  4.   --backup, just incase. also for more complex code :/ oh well.
  5.   pullBack = pullEvent
  6.   osPullBack = os.pullEvent
  7.   rawBack = os.pullEventRaw
  8.   --disable events...
  9.   local pullEvent = os.pullEvent
  10.   os.pullEvent = os.pullEventRaw
  11.  
  12.   write("Enter Password: ")
  13.   input=read("*")
  14.   if input==pass[1] then
  15.     print("WARNING: SIGNED IN AS GUEST. RESTRICTIONS ENABLED")
  16.     user = 0 --note; user=0 is guest, user=1 is a friend, user=2 is me
  17.     sleep(2)
  18.   elseif input==pass[3] then
  19.     print("NOTICE: SIGNED IN AS FRIEND. SOME RESTRICTIONS NOT REMOVED")
  20.     user = 1
  21.     sleep(2)
  22.   elseif input==pass[2] then
  23.     print("SIGNED IN AS LINK. RESTRICTIONS REMOVED")
  24.         --enable events.
  25.         pullEvent = pullBack
  26.         osPullBack = os.pullEvent
  27.         rawBack = os.pullEventRaw
  28.         --complex stuffs. first ask generic what do you want with a 'help'
  29.     user = 2
  30.     sleep(2)
  31.   else
  32.     os.reboot()
  33.   end
  34.    
  35.    
  36.     Username(user,name)
  37.     print("Welcome back "..name)
  38.     write("What do you want to do? (help for list)")
  39.     inputb=read()
  40.    
  41.   if inputb=="help" then
  42.     print("internet (teir 1 required)")
  43.     print("help (teir 0 required)")
  44.     print("exit (reboots computer; teir 0 required)")
  45.     print("Note: no caps in commands.")
  46.    
  47.   elseif inputb=="internet" then
  48.     if user==1 or user>1 then
  49.       Internet()
  50.     else
  51.       permerr()
  52.     end
  53.   end
  54. end
  55.  
  56. function permerr()
  57.   print("WARNING: INSUFFICIENT PERMMISIONS")
  58. end
  59.  
  60. --[[
  61. function Internet()
  62.  local CN="string"
  63.  local name="string"
  64.  local style="string"
  65.  
  66.   term.clear()
  67.   term.setCursorPos(1,1)
  68.   term.write("What kind of internet do you want (host/client)\n")
  69.   term.setCursorPos(1,2)
  70.   style=io.read()
  71.   if style=="join" then
  72.     term.write("What is the name of the chat? \n")
  73.     term.setCursorPos(1,4)
  74.     CN=io.read()  
  75.    
  76.     term.write("What shall you be called? \n")
  77.     term.setCursorPos(1,6)
  78.     name=io.read()
  79.     shell.run("chat join "..CN.." "..name)
  80.   elseif style=="host" then
  81.     term.write("What will be the name of the chat?\n")
  82.     term.setCursorPos(1,4)
  83.     CN=io.read()
  84.     shell.run("chat host "..CN)
  85.   end
  86. end
  87. --]]
  88.  
  89. function Username(teir,res)
  90.   if teir==0 then
  91.     res="guest"
  92.   elseif teir==1 then
  93.     res="friend"
  94.   elseif teir==2 then
  95.     res="Link"
  96.   else
  97.     res="ERROR"
  98.   end
  99.    return(res)
  100. end
  101. Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement