Guest User

Untitled

a guest
Jul 16th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. function DrawRadar()
  2.  
  3. local w_a = ScrW()-200
  4.  
  5. local radar = {}
  6.  
  7. radar.radius = 1024
  8.  
  9. radar.w = 100
  10.  
  11. radar.h = 100
  12.  
  13. radar.x = ScrW()-radar.w
  14.  
  15. radar.y = 0
  16.  
  17. radar.alphascale = 0.6
  18.  
  19. radar.bgcolor = Color(0,200,0,255)
  20.  
  21. radar.fgcolor = Color(0,255,0,255)
  22.  
  23. radar.screendetail = 16
  24.  
  25. radar.screenrotation = 0
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. surface.SetDrawColor( 255, 255, 255, 255 )
  34.  
  35. if LocalPlayer( ):GetNWInt( "Virus" ) == 0 then
  36.  
  37. surface.SetTexture( hud_radar_sur )
  38.  
  39. else
  40.  
  41. surface.SetTexture( hud_radar_inf )
  42.  
  43. end
  44.  
  45. surface.DrawTexturedRect( w_a, 0, 250, 130 )
  46.  
  47.  
  48.  
  49. --surface.DrawCircle( ScrW()-45, 30 , 2, Color(255,255,255,255) )
  50.  
  51.  
  52.  
  53.  
  54.  
  55. local lpl = LocalPlayer()
  56.  
  57. local players = player.GetAll()
  58.  
  59. for i, pl in ipairs(players) do
  60.  
  61. local cx = radar.x+radar.w/2
  62.  
  63. local cy = radar.y+radar.h/2
  64.  
  65. local vdiff = pl:GetPos()-lpl:GetPos()
  66.  
  67. if ( pl:Alive() and lpl!=pl and vdiff:Length()<=radar.radius ) then
  68.  
  69. local px = (vdiff.x/radar.radius)
  70.  
  71. local py = (vdiff.y/radar.radius)
  72.  
  73. local z = math.sqrt( px*px + py*py )
  74.  
  75. local phi = math.Deg2Rad( math.Rad2Deg( math.atan2( px, py ) ) - math.Rad2Deg( math.atan2( lpl:GetAimVector().x, lpl:GetAimVector().y ) ) - 90 )
  76.  
  77. px = math.cos(phi)*z
  78.  
  79. py = math.sin(phi)*z
  80.  
  81. --draw.RoundedBox( 4, cx+px*radar.w/2-4, cy+py*radar.h/2-4, 8, 8, color_ascale(radar.player_color,radar.alphascale) )
  82.  
  83. if LocalPlayer( ):GetNWInt( "Virus" ) == 0 then
  84.  
  85. if pl:GetNWInt( "Virus" ) == 0 then
  86.  
  87. surface.DrawCircle( cx+px*radar.w/2-22, cy+py*radar.h/2+18, 1, Color(0,0,255,255) )
  88.  
  89. else
  90.  
  91. surface.DrawCircle( cx+px*radar.w/2-22, cy+py*radar.h/2+18, 1, Color(255,0,0,255) )
  92.  
  93. end
  94.  
  95. else
  96.  
  97. if pl:GetNWInt( "Virus" ) == 0 then
  98.  
  99. surface.DrawCircle( cx+px*radar.w/2-22, cy+py*radar.h/2+18, 1, Color(255,0,0,255) )
  100.  
  101. else
  102.  
  103. surface.DrawCircle( cx+px*radar.w/2-22, cy+py*radar.h/2+18, 1, Color(0,0,255,255) )
  104.  
  105. end
  106.  
  107. end
  108.  
  109. end
  110.  
  111. end
  112.  
  113.  
  114.  
  115. end
Add Comment
Please, Sign In to add comment