Advertisement
Vispoh

Untitled

Feb 17th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. local sensor = peripheral.wrap('left')
  2. local teleposer = peripheral.wrap('right')
  3.  
  4. redstone.setOutput('right', false)
  5.  
  6. whiteList =
  7. {
  8. --players
  9. 'Vispoh',
  10. }
  11.  
  12. --Compare string to table using
  13. table.contains = function(self, element)
  14. for k,v in pairs(self) do
  15. if v == element then
  16. return true
  17. end
  18. end
  19. return false
  20. end
  21.  
  22. --Main loop
  23. while true do
  24.  
  25. playerTable = sensor.getPlayers()
  26.  
  27. for i = 1,#playerTable do
  28.  
  29. playerName = playerTable[i]["name"]
  30.  
  31. if table.contains(whiteList, playerName)
  32. then
  33. else
  34. redstone.setOutput('right', true)
  35. sleep(1)
  36. teleposer.destroyStack(1)
  37. redstone.setOutput('right', false)
  38. os.reboot()
  39. end
  40. end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement