Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. local Gauss
  2. local C4Distance = 0
  3. local box = gui.Groupbox(gui.Reference('VISUALS', "OTHER", "Options"), "Lethal C4 Radius", 0, 280, 213, 290); --change "280" to a higher number if its overlaps with some other groupbox
  4. local check = gui.Checkbox(box, "check", "Active", 1)
  5. local health_wanted = gui.Slider(box, "health_wanted", "Health Left", 1, 0, 97);
  6. local slider_r = gui.Slider(box, "slider_r", "Red", 221, 0, 255);
  7. local slider_g = gui.Slider(box, "slider_g", "Green", 33, 0, 255);
  8. local slider_b = gui.Slider(box, "slider_b", "Blue", 33, 0, 255);
  9. local slider_a = gui.Slider(box, "slider_a", "Alpha", 80, 0, 255);
  10.  
  11. function calc_dmg(Bomb, Player,BombZ,PlayerZ)
  12.  
  13. local bro_idk = 1
  14. if(engine.GetMapName() == "de_nuke") then
  15. bro_idk = 2.13
  16. else
  17. bro_idk = 1
  18. end
  19. print(bro_idk)
  20.  
  21. Gauss = (math.sqrt((C4Distance^2)+((BombZ-PlayerZ)^2)) - 75.68) / 789.2
  22. local flDamage = 450.7/bro_idk * math.exp(-Gauss * Gauss);
  23.  
  24. if Player:GetProp("m_ArmorValue") > 0 then
  25. local flArmorRatio = 0.5;
  26. local flArmorBonus = 0.5;
  27.  
  28. if Player:GetProp("m_ArmorValue") > 0 then
  29. local flNew = flDamage * flArmorRatio;
  30. local flArmor = (flDamage - flNew) * flArmorBonus;
  31.  
  32. if flArmor > Player:GetProp("m_ArmorValue") then
  33. flArmor = Player:GetProp("m_ArmorValue") * (1 / flArmorBonus);
  34. flNew = flDamage - flArmor;
  35. end
  36.  
  37. flDamage = flNew;
  38. end
  39. end
  40.  
  41. return math.max(flDamage, 0);
  42. end
  43.  
  44. local function drawCircle(x, y, z, radius, thickness, quality)
  45. local quality = quality or 20
  46. local thickness = thickness or 8
  47. local Screen_X_Line_Old, Screen_Y_Line_Old
  48. for rot = 0, 360, quality do
  49. local rot_temp = math.rad(rot)
  50. local LineX, LineY, LineZ = radius * math.cos(rot_temp) + x, radius * math.sin(rot_temp) + y, z
  51. local Screen_X_Line, Screen_Y_Line = client.WorldToScreen(LineX, LineY, LineZ)
  52. if Screen_X_Line ~= nil and Screen_X_Line_Old ~= nil then
  53. draw.SetFont(draw.CreateFont("Tahoma", 12));
  54. draw.Line(Screen_X_Line, Screen_Y_Line, Screen_X_Line_Old, Screen_Y_Line_Old)
  55. for i = 0, thickness do
  56. draw.Line(Screen_X_Line, Screen_Y_Line + i, Screen_X_Line_Old, Screen_Y_Line_Old + i)
  57. end
  58. end
  59. Screen_X_Line_Old, Screen_Y_Line_Old = Screen_X_Line, Screen_Y_Line
  60. end
  61. end
  62.  
  63. callbacks.Register("Draw", function()
  64.  
  65. if check:GetValue() then
  66. local healthW = math.floor(health_wanted:GetValue())
  67. local local_player = entities.GetLocalPlayer();
  68. local bomb = entities.FindByClass("CPlantedC4")[1];
  69.  
  70. if (bomb == nil or local_player == nil or not local_player:IsAlive()) then return end
  71.  
  72. if not (bomb:GetProp("m_bBombTicking") and bomb:GetProp("m_bBombDefused") == 0 and globals.CurTime() < bomb:GetProp("m_flC4Blow")) then
  73. return
  74. end
  75. local bomb_origin_x, bomb_origin_y, bomb_origin_z = bomb:GetAbsOrigin()
  76. local player_origin_x, player_origin_y, player_origin_z = local_player:GetAbsOrigin()
  77. local damage
  78. local radius = 0
  79.  
  80. repeat
  81. damage = calc_dmg(bomb, local_player,bomb_origin_z,player_origin_z)
  82. health_left = local_player:GetHealth() - damage
  83. if health_left < healthW then
  84. C4Distance = C4Distance + 1
  85. end
  86.  
  87. if health_left > healthW+2 and health_left ~= healthW+1 then
  88. C4Distance = C4Distance - 1
  89. end
  90. until (C4Distance == 1500 or health_left > 0)
  91.  
  92. radius = C4Distance
  93.  
  94. -- thick circle
  95. print(C4Distance,(math.sqrt((C4Distance^2)+((bomb_origin_z-player_origin_z)^2))),health_left)
  96. draw.Color(slider_r:GetValue(), slider_g:GetValue(), slider_b:GetValue(), slider_a:GetValue());
  97. drawCircle(bomb_origin_x, bomb_origin_y, player_origin_z, radius, 10, 1)
  98. end
  99. end)
  100.  
  101. client.AllowListener('bomb_exploded')
  102. client.AllowListener('round_start')
  103. callbacks.Register('FireGameEvent', function(event)
  104. if (event:GetName() == "bomb_exploded" or event:GetName() == "round_start") then
  105. C4Distance = 0
  106. end
  107. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement