Advertisement
PiXLFAIL

Tueroeffner mit cords

Oct 27th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2. playersensor = "top" -- <- an der seite ist der sensor
  3. redstonesignal = "left" -- <- hier wird das
  4. --redstonesignal ausgegeben
  5. --moeglichkeiten: left right top bottom front back
  6.  
  7. local sen = sensor.wrap(playersensor)
  8. while true do
  9.   local stat = true
  10.   local targets = sen.getTargets()
  11.   for k, v in pairs(targets) do
  12.     if v.Name == "Player"
  13.     and v.Position.X <= 2 and v.Position.X >= 0
  14.     and v.Position.Y <= 10 and v.Position.Y >= -10
  15.     and v.Position.Z <= 1 and v.Position.Z >= -2
  16.     then
  17.       details = sen.getTargetDetails(k)
  18.       for k1,v1 in pairs(details) do
  19.         if k1 == "Inventory" then
  20.           for i = 1,#v1 do
  21.             if v1[i].Name == "420" then
  22.               stat = false
  23.             end
  24.           end
  25.         end
  26.       end
  27.     end
  28.   end
  29.   rs.setOutput(redstonesignal, stat)
  30.   sleep(0.2)
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement