Advertisement
Fabrimat

CTC_Dateo

Mar 6th, 2021 (edited)
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2.  
  3. redstoneSide = "left"
  4. openTime = 2
  5.  
  6. local maxw, maxh = term.getSize()
  7.  
  8. function printCentered(text)
  9.     local maxw, maxh = term.getSize()
  10.     local curx, cury = term.getCursorPos()
  11.     term.setCursorPos((maxw - #text) / 2, cury)
  12.     term.write(text)
  13.     term.setCursorPos(curx, cury + 1)
  14. end
  15.  
  16. rs.setOutput(redstoneSide, true)
  17. while true do
  18.     term.clear()
  19.     term.setCursorPos(1, math.floor(maxh / 2))
  20.     printCentered("Benvenuto!")
  21.     print()
  22.     printCentered("Tocca il sensore per entrare")
  23.     event, playerName = os.pullEvent()
  24.     if event == "player" then
  25.         print()
  26.         printCentered("Ciao, " .. playerName)
  27.         rs.setOutput(redstoneSide, false)
  28.         http.get("http://172.16.20.227/~fabrimat/rgr/user_access_ctc.php?player=" .. playerName)
  29.         os.sleep(openTime)
  30.         rs.setOutput(redstoneSide, true)
  31.     end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement