Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- playersensor = "top" -- <- an der seite ist der sensor
- redstonesignal = "left" -- <- hier wird das
- --redstonesignal ausgegeben
- --moeglichkeiten: left right top bottom front back
- local sen = sensor.wrap(playersensor)
- while true do
- local stat = true
- local targets = sen.getTargets()
- for k, v in pairs(targets) do
- if v.Name == "Player"
- and v.Position.X <= 2 and v.Position.X >= 0
- and v.Position.Y <= 10 and v.Position.Y >= -10
- and v.Position.Z <= 1 and v.Position.Z >= -2
- then
- details = sen.getTargetDetails(k)
- for k1,v1 in pairs(details) do
- if k1 == "Inventory" then
- for i = 1,#v1 do
- if v1[i].Name == "420" then
- stat = false
- end
- end
- end
- end
- end
- end
- rs.setOutput(redstonesignal, stat)
- sleep(0.2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement