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, 320);
- local check = gui.Checkbox(box, "check", "Active", false)
- local slider_r = gui.Slider(box, "slider_r", "Red", 255, 0, 255);
- local slider_g = gui.Slider(box, "slider_g", "Green", 255, 0, 255);
- local slider_b = gui.Slider(box, "slider_b", "Blue", 255, 0, 255);
- local slider_a = gui.Slider(box, "slider_a", "Alpha", 255, 0, 255);
- function calc_dmg(Bomb, Player)
- Gauss = (C4Distance - 75.68) / 789.2
- local flDamage = 450.7 * 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, r, g, b, a)
- 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.Color(r, g, b, a)
- 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 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)
- health_left = local_player:GetHealth() - damage
- if health_left < 0 then
- C4Distance = C4Distance + 1
- end
- if health_left > 0 then end
- until (C4Distance == 1500 or health_left > 0)
- radius = C4Distance
- -- 'cylinder'
- --for i=1,150,1 do
- -- drawCircle(bomb_origin_x, bomb_origin_y, player_origin_z+i, radius, 1, 40, 221, 33, 33, 100)
- --end
- -- thick circle
- 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, 221, 33, 33, 100)
- end
- end)
- client.AllowListener('bomb_exploded')
- callbacks.Register('FireGameEvent', function(event)
- if (event:GetName() == "bomb_exploded") then
- C4Distance = 0
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement