Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sensor = peripheral.wrap("top")
- chat = peripheral.wrap("bottom")
- speaker = peripheral.wrap("left")
- ant = peripheral.wrap("back")
- gd = 200
- me = "kovakovi2000"
- prefix = "[CUBE] "
- players = sensor.getNearbyPlayers(gd)
- w_near = {}
- w_close = {}
- w_inside = {}
- helmet = ant.getPlayers()
- con = false
- xme = 0
- for i = 1, table.getn(helmet) do
- if helmet[i] == me then
- xme = i
- con = true
- end
- end
- if not con then
- error("No master found")
- end
- ame = ant.getHUD(helmet[xme])
- white = ame.getColorFromRGB(255,255,255,255)
- red = ame.getColorFromRGB(255,0,0,255)
- yellow = ame.getColorFromRGB(255,255,0,255)
- green = ame.getColorFromRGB(0,255,0,255)
- function dws(str,ly,color)
- ame.drawString(str,100,ly,color)
- end
- function createHUD()
- ame.drawString(prefix,100,12,white)
- ame.drawHorizontalLine(100,24,200,white)
- end
- ame.clear()
- createHUD()
- ame.sync()
- y = 0
- while true do
- createHUD()
- ame.sync()
- sleep(0.1)
- y = 26
- players = sensor.getNearbyPlayers(gd)
- for i = 1, table.getn(players) do
- if players[i].player ~= me then
- local dis = players[i].distance
- local sdis = string.format("%2.2f",dis)
- if dis < 10.0 then
- dws(players[i].player .. " " .. sdis, y, red)
- y = y + 12
- chat.tell(players[i].player , prefix .. "YOU HAVE NO PERMISSON TO BE HERE, MY MASTER WILL KNOW IT!")
- speaker.speak("YOU HAVE NO PERMISSON TO BE HERE, MY MASTER WILL KNOW IT!", 10)
- sleep(1)
- elseif 10.0 < dis and dis < 20.0 then
- dws(players[i].player .. " " .. sdis, y, yellow)
- y = y + 12
- elseif 20.0 < dis and dis < 30.0 then
- dws(players[i].player .. " " .. sdis, y, green)
- y = y + 12
- elseif 30.0 < dis then
- dws(players[i].player .. " " .. sdis, y, white)
- y = y +12
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement