Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local speakers = table.pack(peripheral.find("speaker"))
- local playerDetector = table.pack(peripheral.find("playerDetector"))
- local RedstoneControl = peripheral.find("redstoneIntegrator")
- -- local chat = peripheral.find("chat")
- local AllowedUser = "supreamcallum45"
- function alarmsound()
- -- while true do
- for i = 1, speakers.n do
- speakers[i].playSound("minecraft:block.note_block.bell", 3, 0.5)
- speakers[i].playSound("minecraft:block.note_block.bell", 3, 1)
- speakers[i].playSound("minecraft:block.note_block.bell", 3, 1.5)
- speakers[i].playSound("minecraft:block.note_block.bell", 3, 2)
- speakers[i].playSound("minecraft:block.note_block.bell", 3, 1.5)
- speakers[i].playSound("minecraft:block.note_block.bell", 3, 1)
- speakers[i].playSound("minecraft:block.note_block.bell", 3, 0.5)
- end
- sleep(0.05)
- print("ALARM")
- -- end
- end
- function getPlayers(range)
- for o = 1, playerDetector.n do
- local players = playerDetector[o].getPlayersInRange(range) --Returns a table of every player in a certain range
- for k,v in pairs(players) do --we use a for loop to print the names of every player
- -- print(v) --We print every player name
- if AllowedUser ~= v then
- alarmsound()
- end
- end
- end
- end
- -- function printPlayerCords(player) --this function will print the coordinates of the player
- -- for o = 1, playerDetector.n do
- -- local pos = playerDetector[o].getPlayerPos(player) --getPlayerPos returns a table with coordinates
- -- print("X of ".. player .." is: ".. pos.x)
- -- print("Y of ".. player .." is: ".. pos.y)
- -- print("Z of ".. player .." is: ".. pos.z)
- -- end
- -- end
- -- getPlayers(10)
- -- printPlayerCords("supreamcallum45")
- -- alarmsound()
- while true do
- while RedstoneControl.getInput("front") == true do
- getPlayers(10)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement