Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----- bomb timer lua for aimware by solo -----
- local ref = gui.Reference("MISC", "GENERAL", "Main");
- local mouseX, mouseY, x, y, dx, dy, w, h = 0, 0, 650, 10, 0, 0, 400, 50;
- local shouldDrag = false;
- local fonticon = draw.CreateFont("icomoon", 25, 25);
- local fontinfo = draw.CreateFont("Verdana", 15, 15);
- local fonttext = draw.CreateFont("Verdana", 15, 15);
- local fontbombtext = draw.CreateFont("skeet Smallest Pixel-7 Modified", 10, 15);
- local defusing = false;
- function EventHook(Event)
- if Event:GetName() == "bomb_begindefuse" then
- defusing = true;
- elseif Event:GetName() == "bomb_abortdefuse" then
- defusing = false;
- elseif Event:GetName() == "round_officially_ended"
- or Event:GetName() == "bomb_defused" or Event:GetName() == "bomb_exploded" then
- defusing = false;
- end
- end
- local function dragFeature()
- if input.IsButtonDown(1) then
- mouseX, mouseY = input.GetMousePos();
- if shouldDrag then
- x = mouseX - dx;
- y = mouseY - dy;
- end
- if mouseX >= x and mouseX <= x + w and mouseY >= y and mouseY <= y + 40 then
- shouldDrag = true;
- dx = mouseX - x;
- dy = mouseY - y;
- end
- else
- shouldDrag = false;
- end
- end
- local function drawTimer()
- if entities.FindByClass("CPlantedC4")[1] ~= nil then
- local Bomb = entities.FindByClass("CPlantedC4")[1];
- if Bomb:GetProp("m_bBombTicking") and Bomb:GetProp("m_bBombDefused") == 0 and globals.CurTime() < Bomb:GetProp("m_flC4Blow") then
- local Player = entities.GetLocalPlayer();
- if defusing == true then
- local BombMath = ((globals.CurTime() - Bomb:GetProp("m_flDefuseCountDown")) * 0.5) / ((Bomb:GetProp("m_flDefuseCountDown") - Bomb:GetProp("m_flDefuseLength")) - Bomb:GetProp("m_flDefuseCountDown")) + 1;
- draw.Color(8, 8, 8, 30)
- draw.FilledRect(x, y, x + w, y + h)
- draw.FilledRect(x - 65, y, x + (w - 405), y + h )
- draw.Color(8, 8, 8, 90)
- draw.FilledRect(x + 20, y + 20, x + (w - 20), y + h - 20)
- draw.Color(0, 150, 255, 240)
- draw.FilledRect(x + 20, y + 20, (x + 20) * BombMath, y + h - 20)
- draw.Color(180, 180, 180, 120)
- draw.OutlinedRect(x, y, x + w, y + h)
- draw.OutlinedRect(x - 65,y , x + (w - 405), y + h)
- draw.Color(255, 255, 255, 255)
- draw.SetFont(fontbombtext)
- draw.Text(x - 48, y + 30, "BOMB")
- draw.SetFont(fonticon)
- draw.Text(x - 50, y + 10, "y")
- else
- local BombMath = ((globals.CurTime() - Bomb:GetProp("m_flC4Blow")) * 0.5) / ((Bomb:GetProp("m_flC4Blow") - Bomb:GetProp("m_flTimerLength")) - Bomb:GetProp("m_flC4Blow")) + 1;
- draw.Color(8, 8, 8, 30)
- draw.FilledRect(x, y, x + w, y + h)
- draw.FilledRect(x - 65, y, x + (w - 405), y + h )
- draw.Color(8, 8, 8, 90)
- draw.FilledRect(x + 20, y + 20, x + (w - 20), y + h - 20)
- draw.Color(130, 255, 0, 240)
- draw.FilledRect(x + 20, y + 20, (x + 20) * BombMath, y + h - 20)
- draw.Color(180, 180, 180, 120)
- draw.OutlinedRect(x, y, x + w, y + h)
- draw.OutlinedRect(x - 65,y , x + (w - 405), y + h)
- draw.Color(255, 255, 255, 255)
- draw.SetFont(fontbombtext)
- draw.Text(x - 48, y + 30, "BOMB")
- draw.SetFont(fonticon)
- draw.Text(x - 50, y + 10, "y")
- end
- if Player:IsAlive() and globals.CurTime() < Bomb:GetProp("m_flC4Blow") then
- if math.floor(0.5 + BombDamage(Bomb, Player)) >= Player:GetHealth() then
- draw.Color(255, 0, 0, 255)
- draw.SetFont(fontinfo)
- draw.Text(5, 0, "LETHAL");
- draw.TextShadow(5, 0, "LETHAL");
- else
- draw.Color(255, 255, 255, 255)
- draw.SetFont(fontinfo)
- draw.Text(5, 0, math.floor(0.5 + BombDamage(Bomb, Player)) .. " HP");
- draw.TextShadow(5, 0, math.floor(0.5 + BombDamage(Bomb, Player)) .. " HP");
- end
- end
- end
- end
- end
- function BombDamage(Bomb, Player)
- local C4Distance = math.sqrt((select(1,Bomb:GetAbsOrigin()) - select(1,Player:GetAbsOrigin())) ^ 2 +
- (select(2,Bomb:GetAbsOrigin()) - select(2,Player:GetAbsOrigin())) ^ 2 +
- (select(3,Bomb:GetAbsOrigin()) - select(3,Player:GetAbsOrigin())) ^ 2);
- local 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
- callbacks.Register( "Draw", "drag", dragFeature)
- callbacks.Register("FireGameEvent", "EventHookB", EventHook);
- callbacks.Register( "Draw", "drawTimer", drawTimer );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement