Advertisement
denvys5

GovnoCode for zayavki V2

Feb 23rd, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. sensor = peripheral.wrap("left")
  2. gterm = peripheral.wrap("top")
  3. owner = SvechAS
  4.  
  5. local pl_list = {}
  6. local pl_pos = {}
  7.  
  8. gterm.clear()
  9. pl_box = gterm.addBox(5, 25, 100, 10, 0x000000, 0.4)
  10. gterm.addText(6, 26, "Players nearby:", 0xFFFFFF)
  11. gterm.addBox(5, 150, 100, 100, 0x339933, 0.2)
  12. for i = 0, 19 do
  13.         pl_pos[i] = gterm.addBox(0, 0, 5, 5, 0xFFFFFF, 0.2)
  14. end
  15.  
  16. while true do
  17.         pl = sensor.getPlayerNames()
  18.         pl_box.setHeight(10 + 10 * #pl)
  19.        
  20.         q = 0
  21.         for i, j in pairs(pl) do
  22.                 data = sensor.getPlayerData(j)
  23.                 pos = data["position"]
  24.                 pl_pos[i].setX(pos["x"] + 55)
  25.                 pl_pos[i].setY(pos["z"] + 205)
  26.                 pl_list[i] = gterm.addText(6, 26 + 10 * i, j, 0xFFFFFF)
  27.         end
  28.        
  29.         os.sleep(5)
  30.        
  31.         for i = 1, #pl do
  32.                 pl_list[i].delete()
  33.         end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement