Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sensor = peripheral.wrap('left')
- local teleposer = peripheral.wrap('right')
- redstone.setOutput('right', false)
- whiteList =
- {
- --players
- 'Vispoh',
- }
- --Compare string to table using
- table.contains = function(self, element)
- for k,v in pairs(self) do
- if v == element then
- return true
- end
- end
- return false
- end
- --Main loop
- while true do
- playerTable = sensor.getPlayers()
- for i = 1,#playerTable do
- playerName = playerTable[i]["name"]
- if table.contains(whiteList, playerName)
- then
- else
- redstone.setOutput('right', true)
- sleep(1)
- teleposer.destroyStack(1)
- redstone.setOutput('right', false)
- os.reboot()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement