Use this:
[lua]
hitmarker_con = CreateClientConVar("cl_hitmarker",1,true,false)
function Hitmarker(ent,inf,att,am,dmginfo)
if att:IsPlayer() and (ent:IsNPC() or ent:IsPlayer() or ent:IsVehicle()) then
att:SetNWBool("hitmarker",false)
att:SetNWBool("hitmarker",true)
att:SetNWFloat("hitmarker_time",CurTime()+0.35)
end
end
function Hitmarker_draw()
if hitmarker_con:GetInt() != 1 then return end
ply = LocalPlayer()
hitmarker = ply:GetNWBool("hitmarker")
hitmarker_time = ply:GetNWFloat("hitmarker_time")
if hitmarker and CurTime() < hitmarker_time then
--gets the center of the screen
local x = ScrW() / 2
local y = ScrH() / 2
--set the drawcolor
surface.SetDrawColor( 225, 225, 225, 255 )
--draw the crosshair
surface.DrawLine( x+7, y-7, x+15, y-15 )
surface.DrawLine( x-7, y+7, x-15, y+15 )
surface.DrawLine( x+7, y+7, x+15, y+15 )
surface.DrawLine( x-7, y-7, x-15, y-15 )
end
end
hook.Add("EntityTakeDamage","hitmarker",Hitmarker)
hook.Add("HUDPaint","Hitmarker_draw",Hitmarker_draw)
[/lua]
It's alot simpler and it works on NPCs, Vehicles, and Players
Thank you ROFLBURGER :)
I will credit you definitely for this code.
I didn't make it, just to let you know.
I got it from garrysmod.org
Sorry, you need to Log In to post a reply to this thread.