--pavetr.top/ds --[[ <-- Author - Nellored --> [ Variant with hitboxes ] --]] local hitlogs = {data = {}} local add = {x = 0, y = 0} local helpers = { lerp = function(self, start, end_pos, time, delta) if (math.abs(start - end_pos) < (delta or 0.01)) then return end_pos end time = FrameTime() * (time * 175) if time < 0 then time = 0.01 elseif time > 1 then time = 1 end return ((end_pos - start) * time + start) end, } local MultiColorText = function(data, x, y) local total_width = 0 local width = 0 surface.SetFont( "font" ) for _, v in pairs(data) do local text = v[1] local text_width, text_height = surface.GetTextSize( text ) total_width = total_width + text_width end for _, v in ipairs(data) do local text = v[1] local text_width, text_height = surface.GetTextSize( text ) local x2 = (x - total_width / 2 + width) draw.SimpleText( v[1], "font", x2+1, y+1, Color( 0, 0, 0, v[2].a) ) draw.SimpleText( v[1], "font", x2, y, v[2] ) width = width + text_width end end hitlogs.on_draw = function() local sc = {x = ScrW(), y = ScrH()} local x, y = sc.x/2, sc.y/1.1 add.y = 0 for k, v in ipairs(hitlogs.data) do local text = v[1] local r, g, b = v.color.r, v.color.g, v.color.b local realtime = RealTime() if v.time + 1 > realtime then v.alpha = helpers:lerp(v.alpha, 1, 0.095) v.alpha1 = helpers:lerp(v.alpha, 1, 0.05) end add.y = add.y + 15*v.alpha local wh = Color(255, 255, 255, v.alpha*255) local ch = Color(r, g, b, v.alpha*255) MultiColorText({ { text[1], wh }, { text[2], ch }, { text[3], wh }, { text[4], ch }, { text[5], wh }, { text[6], ch }, { text[7], wh }, { text[8], ch }, { text[9], wh } }, x + v.alpha1*100 - 100, y - add.y) if v.time + 5 < realtime then v.alpha = helpers:lerp(v.alpha, 0, 0.05) v.alpha1 = helpers:lerp(v.alpha1, 2, 0.04) end if v.alpha < 0.01 and (v.time + 6 < realtime) or #hitlogs.data > 50 then table.remove(hitlogs.data, k) end end end surface.CreateFont("font", { font = "Verdana", size = 15, antialias = true }) local hitboxes = { ["ValveBiped.Bip01_R_Hand"] = "Right Hand", ["ValveBiped.Bip01_R_Forearm"] = "Right Hand", ["ValveBiped.Bip01_R_UpperArm"] = "Right Hand", ["ValveBiped.Bip01_L_Hand"] = "Left Hand", ["ValveBiped.Bip01_L_Forearm"] = "Left Hand", ["ValveBiped.Bip01_L_UpperArm"] = "Left Hand", ["ValveBiped.Bip01_Spine2"] = "Chest", ["ValveBiped.Bip01_Pelvis"] = "Pelvis", ["ValveBiped.Bip01_R_Thigh"] = "Right Leg", ["ValveBiped.Bip01_R_Calf"] = "Right Leg", ["ValveBiped.Bip01_R_Toe0"] = "Right Leg", ["ValveBiped.Bip01_R_Foot"] = "Right Leg", ["ValveBiped.Bip01_L_Thigh"] = "Left Leg", ["ValveBiped.Bip01_L_Calf"] = "Left Leg", ["ValveBiped.Bip01_L_Toe0"] = "Left Leg", ["ValveBiped.Bip01_L_Foot"] = "Left Leg", ["ValveBiped.Bip01_Head1"] = "Head" } gameevent.Listen( "player_hurt" ) hook.Add("player_hurt", "AnnounceConnection", function( data ) local ply = Player( data.attacker ) local plu = Player( data.userid ) if (ply == nil or ply:IsPlayer() == false) or plu == nil or ply:GetEyeTrace().HitBoxBone == nil then return end table.insert(hitlogs.data, { { "Hit ", plu:Nick(), " in the ", hitboxes[plu:GetBoneName(ply:GetEyeTrace().HitBoxBone)], " for ", tostring(string.gsub(data.health-plu:Health(), "-", "")), " damage (", tostring(data.health), " health remaining)", }, alpha = 0, alpha1 = 0, time = RealTime(), color = Color(255, 0, 0), }) end) hook.Add("HUDPaint", "adsdafvxcf", function() hitlogs.on_draw() end)