daily pastebin goal
22%
SHARE
TWEET

Untitled

Vispoh Feb 17th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top