Guest User

startup

a guest
Jan 21st, 2013
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.71 KB | None | 0 0
  1. --Opzioni di configurazione
  2. colWelcome = colors.lime
  3. colPlayer = colors.white
  4. colIscritti = colors.red
  5. tempoApertura = 4
  6. durataAllarme = 7
  7. elencoAmmessi = {"Darkhim", "SurrealPower", "HEXEVIL", "Keledan", "Wr3nt" , "KIRIAIR", "Ulisse1996" }
  8.  
  9. function scanTable(table, search)
  10.   for i=1, #table do
  11.     if table[i]==search then
  12.       return true
  13.     end
  14.   end
  15.   return false
  16. end
  17.  
  18. --Collega il Monitor
  19. local monitor = peripheral.wrap("back")
  20.   term. clear()
  21.   print("Premi C per cancellare la scritta a schermo")
  22.   print("Premi X per interrompere")  
  23.  
  24. function interfaccia(comando)
  25.   if comando == "c" then
  26.     monitor.clear()
  27.     print ("\n\n Monitor cancellato")
  28.     sleep (2)
  29.   end
  30.  
  31.   if comando == "x" or comando =="X" then
  32.     print ("Uscita in corso")
  33.     sleep(1)
  34.     os.shutdown()
  35.   end  
  36. end
  37.                
  38.   function faiEntrare(player)  
  39.     local playerChannel = "null"
  40.     playerChannel = player
  41.     if player == "Keledan" then playerChannel = "Keledan75" end
  42.     if player == "Darkhim" then playerChannel = "Darkhim85" end    
  43.     if player == "SurrealPower" then playerChannel = "SurreaIPower" end
  44.     if player == "Ulisse1996" then playerChannel = "XUlisse1996" end
  45.     if player == "HEXEVIL" then playerChannel = "EternaLoveLC" end
  46.  
  47.     monitor.clear()
  48.     monitor.setCursorPos(2,2)
  49.     monitor.setTextScale(2.5)
  50.     monitor.setTextColor(colWelcome)
  51.     monitor.write ("Benvenuto")
  52.     monitor.setCursorPos(2,4)
  53.     monitor.setTextScale(2.5)
  54.     monitor.setTextColor(colPlayer)
  55.     monitor.write (player)
  56.               local iscritti= http.get("http://www.truemetal.it/youtube/youtube.php?channel=" .. playerChannel .. "&funzione=iscritti")
  57.     monitor.setTextColor(colIscritti)
  58.     monitor.setCursorPos(2,6)
  59.     monitor.write("Iscritti ")
  60.     monitor.write (iscritti.readAll())
  61.     iscritti.close()
  62.     redstone.setOutput ("front", true)
  63.     sleep(tempoApertura)
  64.     redstone.setOutput ("front", false)
  65.  end    
  66.  
  67.  function buttaFuori()
  68.    monitor.setTextColor(colors.lime)
  69.    monitor.clear()
  70.    monitor.setCursorPos(2,2)
  71.    monitor.setTextScale(2.5)
  72.    monitor.write(player)
  73.    monitor.setTextColor(colors.red)
  74.    monitor.setCursorPos(2,4)
  75.    monitor.write("TU NON PUOI")
  76.    monitor.setCursorPos(2,6)
  77.    monitor.write("PASSARE!")
  78.    redstone.setOutput("left", true)
  79.    sleep(durataAllarme)
  80.    redstone.setOutput("left", false)
  81.   end
  82.  
  83. while true do
  84.   event, player = os.pullEvent()
  85.   if event == "player" then  
  86.     ammesso = scanTable(elencoAmmessi, player)
  87.     if ammesso == true then
  88.       faiEntrare(player)
  89.     end
  90.  
  91.   if ammesso == false then
  92.       buttaFuori(player)
  93.     end
  94.   elseif event == "char" then
  95.     interfaccia(player)      
  96.   end
  97. end
Advertisement
Add Comment
Please, Sign In to add comment