TTT Hit Markers

Overview:
Here we have a VERY simple addon for TTT.
It’s a hitmarker script (shows when you’ve actually hit someone when you’ve shot them)
Install it by creating a .lua file under lua/autorun and pasting the code in.

Reason:
I’ve noticed that a lot of times that when you shoot someone in TTT you can see the blood and nothing happens and they’ll kill you because you were too naive to check. This will only draw when a hit is registered therefore you know that you have actually hit them.

Example:

Yeah it’s shitty image.

Since it only has 36 lines. I’m just gonna dump it here:


if (CLIENT) then
	hit = false
	W = ScrW()/2
	H = ScrH()/2
	usermessage.Hook("HIT_MARK", function()
		hit = true
		trans = 150
		timer.Simple(0.2, function()   
			hook.Add("Think", "fade", function()
				trans = trans - 5
				if trans <= 0 then
					hook.Remove("Think", "fade")
					hit = false
				end
			end)
		end)
	end)
	
	hook.Add("HUDPaint", "Hitmarkers", function()
		if hit then
			surface.SetDrawColor(255,255,255,trans)
			surface.DrawLine(W-2,H-2,W-8,H-8)
			surface.DrawLine(W+2,H-2,W+8,H-8)
			surface.DrawLine(W+2,H+2,W+8,H+8)
			surface.DrawLine(W-2,H+2,W-8,H+8)
		end
	end)
end

if (SERVER) then
	hook.Add("PlayerHurt", "HIT_PLAYER", function(ply, attacker)
		if IsValid(attacker) and attacker:IsPlayer() then
			umsg.Start( "HIT_MARK", attacker )
			umsg.End()
		end
	end)
end

TL;DR: It’s a 5 second script that draws hitmarkers like in Call of Duty. Paste the code in lua/autorun.

This script has been around for ages, in fact I’m pretty sure it’s already on here .

Did you make this?

With some help (not gonna lie I’m not that good with using W and H) yes I did make it. My apologies if this is not very useful or impressive. Also I didn’t know this had already been posted before so sorry about that.

While coolvetica is lovely, I’ve seen hitmarkers already existing that look exactly like this, so you should play around with font, colour and text size

This is the SAME script I have seen in a “Coderhire leaked pack”

and why would you have a ‘Coderhire leaked pack’?

Why not, i got banned from coderhire.

[editline]24th June 2014[/editline]

I think I found the script he leaked / uploaded here. (Don’t know if this is the script but I expect)

That pack has a line over the crosshair on hit, this shows visual indication of amount of damage done. I know there was a hit marker pack on Coderhire ages ago, but it looked nothing like this and honestly, not very good

There was one on the Workshop though, which I now cannot find sadly

-snip-, wrong one

http://steamcommunity.com/sharedfiles/filedetails/?id=133054661

oh geez

Why are there so many versions of the same thing… :expressionless:

And the one I am posting in.
I cant choose.

Use the one that is the best coded/most efficient. The one isnipeu posted code for obviously is not that one. Not being able to choose which free addon to use is such a trivial issue.

Oh my god, I’m an idiot and thought the thing being pointed out in the screenshot was the damage number, not the hit marker

Please ignore everything I’ve said

Well, I was not sure yesterday. :smiley: