// Target ID function GM:HUDDrawTargetID() local tr = util.GetPlayerTrace( LocalPlayer() ) local trace = util.TraceLine( tr ) if (!trace.Hit) then return end if (!trace.HitNonWorld) then return end if (trace.Entity:IsPlayer()) then local namewidth, nameheight = surface.GetTextSize(trace.Entity:Nick()) local distwidth, distheight = surface.GetTextSize("(@" .. math.Round(LocalPlayer():GetPos():Distance(trace.Entity:GetPos())) .. ")") // Target ID area if namewidth > distwidth then draw.RoundedBox(0, (ScrW() / 2) - (namewidth / 2) - 4, (ScrH() / 2) - 74, namewidth + 6, 32, Color(0, 0, 0, 200)) else draw.RoundedBox(0, (ScrW() / 2) - (distwidth / 2) - 4, (ScrH() / 2) - 74, distwidth + 6, 32, Color(0, 0, 0, 200)) end // Target ID text surface.SetFont("Default") draw.SimpleText(trace.Entity:Nick(), "Default", (ScrW() / 2) - (namewidth / 2), (ScrH() / 2) - 72, Color(200, 15, 15, 200)) draw.SimpleText("(@" .. math.Round(LocalPlayer():GetPos():Distance(trace.Entity:GetPos())) .. ")", "Default", (ScrW() / 2) - (distwidth / 2), (ScrH() / 2) - 58, Color(200, 15, 15, 200)) end end