mariodkzzzz

Player sensor Computercraft

Mar 25th, 2015
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. local p = peripheral.wrap("top")
  2.  
  3. username = info[1].name
  4. pos = p.getPlayerByName(username).position
  5.  
  6. while true do
  7.   info = p.getPlayers()
  8.   if info ~= nil then
  9.     for key, value in pairs(info) do
  10.       username = info[1].name
  11.       pos = p.getPlayerByName(username).position
  12.       if pos then
  13.         p.getPlayers()
  14.         if pos.x >= -4 and pos.x <= 4
  15.         and pos.y >= -1 and pos.y <= 5
  16.         and pos.z >= -4 and pos.z <= 4 then
  17.           if ((username == "ShitFace") or (username == "FaceShit")) then
  18.             redstone.setOutput("back", true)
  19.           else
  20.             redstone.setOutput("back", true)
  21.           end
  22.         else
  23.           redstone.setOutput("back", false)
  24.         end
  25.       else
  26.       redstone.setOutput("back", false)
  27.       end
  28.     end
  29.   end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment