Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local detector = peripheral.find("playerDetector")
- if detector == nil then
- print("Aucun détecteur de joueur disponible")
- return
- end
- local speaker = peripheral.find("speaker")
- if speaker == nil then
- print("Aucun speaker disponible")
- return
- end
- local function detectAndAlert()
- local players = detector.getPlayersInCoords({x = -19, y = 0, z = -18}, {x = -18, y = 1, z = -17})
- if #players > 0 then
- print("Joueur détecté à la position (-19, 0, -18)")
- speaker.playNote("harp", 1, 12)
- else
- print("Aucun joueur détecté à la position (-19, 0, -18)")
- end
- end
- while true do
- detectAndAlert()
- sleep(1) -- Vérifie toutes les secondes
- end
Advertisement
Add Comment
Please, Sign In to add comment