--by exechack.cc surface.CreateFont("HitlogFont",{ font = "Arial", extended = true, size = 18, weight = 800, antialias = true, }) local function sw(px) return (ScrW()/1920)*px end local function sh(px) return (ScrH()/1080)*px end if ValidPanel(hit_log) then hit_log:Remove() end local strlen = utf8 and utf8.len or string.utf8len or string.len hit_log = vgui.Create("RichText") hit_log:SetPos(0,0) hit_log:SetSize(sw(600),sh(250)) local hlog_col = Color(163,82,77,150) hit_log.Paint = function(s,w,h) draw.RoundedBox(0,0,0,w,h,hlog_col) end function hit_log:PerformLayout() self:SetFontInternal("HitlogFont") self:SetFGColor(color_white) end local function formatPly(ply) if not IsValid(ply) then return "Unknown" end return ply:Nick().."("..ply:SteamID()..")" end local function makeHitMarker() LocalPlayer():EmitSound("hl1/fvox/bell.wav") hook.Remove("HUDPaint","pavetryanka.hitmarker") hook.Add("HUDPaint","pavetryanka.hitmarker",function() surface.SetDrawColor(255,255,255) draw.NoTexture() surface.DrawTexturedRectRotated(ScrW()/2,ScrH()/2,50,5,45) surface.DrawTexturedRectRotated(ScrW()/2,ScrH()/2,50,5,-45) end) timer.Simple(0.1,function() hook.Remove("HUDPaint","pavetryanka.hitmarker") end) end gameevent.Listen("player_hurt") hook.Add("player_hurt", "pavetryanka.hitlog", function( data ) local health = data.health // Remaining health after injury local priority = data.priority or 0 // Priority local ply = Player(data.userid) // Same as Player:UserID() local attacker = Player(data.attacker) // Same as Player:UserID() but it's the attacker id. if attacker == LocalPlayer() then makeHitMarker() end if ValidPanel(hit_log) then if hit_log:GetText() and isstring(hit_log:GetText()) and strlen(hit_log:GetText()) >= 60000 then hit_log:SetText("") end local hitcol = color_white if ply == LocalPlayer() then hit_log:InsertColorChange(255,0,0,255) hitcol = Color(255,0,0) elseif attacker == LocalPlayer() then hit_log:InsertColorChange(0,255,0,255) hitcol = Color(0,255,0) else hit_log:InsertColorChange(255,255,255,255) end hit_log:AppendText(formatPly(attacker).." hit "..formatPly(ply)..". HP left: "..health.."\n") MsgC(hitcol,"[HITLOG] ",formatPly(attacker).." hit "..formatPly(ply)..". HP left: "..health.."\n") end end) concommand.Add("closeHitbox",function() if ValidPanel(hit_log) then hit_log:Remove() end hook.Remove("player_hurt", "pavetryanka.hitlog") end)