Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. local m_rings = {}
  2. local main_container = gui.Reference( 'VISUALS', 'MISC', 'Assistance' )
  3. local team_container = gui.Reference( 'VISUALS', 'TEAMMATES', 'Filter' )
  4. local enemy_container = gui.Reference( 'VISUALS', 'ENEMIES', 'Filter')
  5. local main_checkbox = gui.Checkbox( main_container, 'bs_enable', 'Better Sound ESP', false )
  6. local team_checkbox = gui.Checkbox( team_container, 'bs_team_enable', 'Better Sounds', false)
  7. local enemy_checkbox = gui.Checkbox( enemy_container, 'bs_enemy_enable', 'Better Sounds', false)
  8.  
  9. local function Render3DCircle( posX, posY, posZ, rad, res, r, g, b, a )
  10. local vertices = {}
  11. local max_radias = math.pi * 2
  12. local step = max_radias / res
  13.  
  14. for a = 0, max_radias, step do
  15. local ptX, ptY, ptZ, scrX, scrY
  16.  
  17. ptX = ( rad * math.cos( a ) ) + posX
  18. ptY = ( rad * math.sin( a ) ) + posY
  19. ptZ = posZ
  20.  
  21. scrX, scrY = client.WorldToScreen( ptX, ptY, ptZ )
  22.  
  23. if scrX ~= 0 and scrY ~= 0 then
  24. vertices[#vertices + 1] = { x = scrX, y = scrY }
  25. end
  26. end
  27.  
  28. for i = #vertices, 1, -1 do
  29. local next = i - 1
  30.  
  31. if i == 1 then
  32. next = #vertices
  33. end
  34.  
  35. draw.Color( r, g, b, a )
  36. draw.Line( vertices[i].x, vertices[i].y, vertices[next].x, vertices[next].y )
  37. end
  38. end
  39.  
  40. local function PushbackRing( e )
  41. local ent = entities.GetByUserID( e:GetInt( 'userid' ) )
  42. local localPlayer = entities.GetLocalPlayer( )
  43.  
  44. if ent == nil or ent:IsAlive( ) ~= true then
  45. return
  46. end
  47.  
  48. if ent:GetIndex( ) == localPlayer:GetIndex( ) then
  49. return
  50. end
  51.  
  52. if ent:GetTeamNumber( ) == localPlayer:GetTeamNumber( ) and team_checkbox:GetValue( ) == false then
  53. return
  54. end
  55.  
  56. if ent:GetTeamNumber( ) ~= localPlayer:GetTeamNumber( ) and enemy_checkbox:GetValue( ) == false then
  57. return
  58. end
  59.  
  60. local vX, vY, vZ = ent:GetAbsOrigin( )
  61. local fc = globals.FrameCount( )
  62.  
  63. m_rings[#m_rings + 1] = {
  64. pos = { x = vX, y = vY, z = vZ },
  65. framecount = iFrameCount,
  66. alpha = 255,
  67. framecount = fc,
  68. currentRadius = 0,
  69. endRadius = 100
  70. }
  71. end
  72.  
  73. local function RenderRings( )
  74. for ind = #m_rings, 1, -1 do
  75. if m_rings[ind] == nil then
  76. return
  77. end
  78.  
  79. local curRing = m_rings[ind]
  80.  
  81. if curRing.currentRadius == curRing.endRadius then
  82. table.remove( m_rings, ind )
  83. return
  84. end
  85.  
  86. local timeSince = globals.FrameCount( ) - curRing.framecount
  87.  
  88. if timeSince % 5 == 0 then
  89. curRing.currentRadius = curRing.currentRadius + 2
  90. curRing.alpha = 255 - ( ( 255 / curRing.endRadius ) * curRing.currentRadius )
  91. end
  92.  
  93. Render3DCircle( curRing.pos.x, curRing.pos.y, curRing.pos.z, curRing.currentRadius, 30, 255, 255, 255, curRing.alpha )
  94. end
  95. end
  96.  
  97. callbacks.Register( 'FireGameEvent', function( e )
  98. if main_checkbox:GetValue( ) == false then
  99. return
  100. end
  101.  
  102. local localPlayer = entities.GetLocalPlayer( )
  103.  
  104. if ( e == nil or localPlayer == nil ) then
  105. return
  106. end
  107.  
  108. if e:GetName( ) == 'player_hurt' or 'player_jump' or 'player_footstep' or 'player_falldamage' or 'weapon_fire' then
  109. PushbackRing( e )
  110. end
  111. end )
  112.  
  113. callbacks.Register( 'Draw', function( )
  114. if main_checkbox:GetValue( ) == false then
  115. return
  116. end
  117.  
  118. RenderRings( )
  119. end )
  120.  
  121. client.AllowListener( 'player_hurt' )
  122. client.AllowListener( 'player_jump' )
  123. client.AllowListener( 'player_footstep' )
  124. client.AllowListener( 'player_falldamage' )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement