Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Gauss
- local C4Distance = 0
- 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
- local check = gui.Checkbox(box, "check", "Active", 1)
- local health_wanted = gui.Slider(box, "health_wanted", "Health Left in % from Current Health", 1, 0, 100);
- local slider_r = gui.Slider(box, "slider_r", "Red", 221, 0, 255);
- local slider_g = gui.Slider(box, "slider_g", "Green", 33, 0, 255);
- local slider_b = gui.Slider(box, "slider_b", "Blue", 33, 0, 255);
- local slider_a = gui.Slider(box, "slider_a", "Alpha", 80, 0, 255);
- function calc_dmg(Bomb, Player,BombZ,PlayerZ)
- local bro_idk = 1
- if(engine.GetMapName() == "de_nuke") then
- bro_idk = 2.135
- else
- bro_idk = 1
- end
- Gauss = (math.sqrt((C4Distance^2)+((BombZ-PlayerZ)^2)) - 75.68) / 789.2
- local flDamage = 450.7/bro_idk * math.exp(-Gauss * Gauss);
- if Player:GetProp("m_ArmorValue") > 0 then
- local flArmorRatio = 0.5;
- local flArmorBonus = 0.5;
- if Player:GetProp("m_ArmorValue") > 0 then
- local flNew = flDamage * flArmorRatio;
- local flArmor = (flDamage - flNew) * flArmorBonus;
- if flArmor > Player:GetProp("m_ArmorValue") then
- flArmor = Player:GetProp("m_ArmorValue") * (1 / flArmorBonus);
- flNew = flDamage - flArmor;
- end
- flDamage = flNew;
- end
- end
- return math.max(flDamage, 0);
- end
- local function drawCircle(x, y, z, radius, thickness, quality)
- local quality = quality or 20
- local thickness = thickness or 8
- local Screen_X_Line_Old, Screen_Y_Line_Old
- for rot = 0, 360, quality do
- local rot_temp = math.rad(rot)
- local LineX, LineY, LineZ = radius * math.cos(rot_temp) + x, radius * math.sin(rot_temp) + y, z
- local Screen_X_Line, Screen_Y_Line = client.WorldToScreen(LineX, LineY, LineZ)
- if Screen_X_Line ~= nil and Screen_X_Line_Old ~= nil then
- draw.SetFont(draw.CreateFont("Tahoma", 12));
- draw.Line(Screen_X_Line, Screen_Y_Line, Screen_X_Line_Old, Screen_Y_Line_Old)
- for i = 0, thickness do
- draw.Line(Screen_X_Line, Screen_Y_Line + i, Screen_X_Line_Old, Screen_Y_Line_Old + i)
- end
- end
- Screen_X_Line_Old, Screen_Y_Line_Old = Screen_X_Line, Screen_Y_Line
- end
- end
- callbacks.Register("Draw", function()
- if check:GetValue() then
- local healthW = math.floor(health_wanted:GetValue())/100
- local local_player = entities.GetLocalPlayer();
- local bomb = entities.FindByClass("CPlantedC4")[1];
- if (bomb == nil or local_player == nil or not local_player:IsAlive()) then return end
- if not (bomb:GetProp("m_bBombTicking") and bomb:GetProp("m_bBombDefused") == 0 and globals.CurTime() < bomb:GetProp("m_flC4Blow")) then
- return
- end
- local bomb_origin_x, bomb_origin_y, bomb_origin_z = bomb:GetAbsOrigin()
- local player_origin_x, player_origin_y, player_origin_z = local_player:GetAbsOrigin()
- local damage
- local radius = 0
- repeat
- damage = calc_dmg(bomb, local_player,bomb_origin_z,player_origin_z)
- health_left = local_player:GetHealth() - damage
- print(local_player:GetHealth()*healthW,math.floor(health_left+0.5))
- if math.floor(health_left) < local_player:GetHealth()*healthW then
- C4Distance = C4Distance + 1
- end
- if math.floor(health_left) > local_player:GetHealth()*healthW and math.floor(health_left) ~= local_player:GetHealth()*healthW then
- C4Distance = C4Distance - 1
- end
- until (C4Distance == 1500 or health_left > 0)
- radius = C4Distance
- -- thick circle
- --print(C4Distance,(math.sqrt((C4Distance^2)+((bomb_origin_z-player_origin_z)^2))),health_left)
- draw.Color(slider_r:GetValue(), slider_g:GetValue(), slider_b:GetValue(), slider_a:GetValue());
- drawCircle(bomb_origin_x, bomb_origin_y, player_origin_z, radius, 10, 1)
- end
- end)
- client.AllowListener('bomb_exploded')
- client.AllowListener('round_start')
- callbacks.Register('FireGameEvent', function(event)
- if (event:GetName() == "bomb_exploded" or event:GetName() == "round_start") then
- C4Distance = 0
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement