Problem with materials drawing through walls.

[lua] local mat = Material(“effects/redflare”)
mat:SetMaterialInt("$ignorez", 0)
for k, v in pairs(player.GetAll()) do
local weapon = v:GetActiveWeapon()
if(weapon:IsValid() and ( weapon:GetClass() == “weapon_silencedusp” or weapon:GetClass() == “weapon_steyrtmp” or weapon:GetClass() == “weapon_coltm4a1” ) and LocalPlayer():GetEyeTrace().HitPos:ToScreen().visible) then
tr = v:GetEyeTrace()
cam.Start3D(EyePos(), EyeAngles())
render.SetMaterial(mat)
render.DrawSprite(tr.HitPos, 12, 12, Color(255,255,255,(math.Rand(0.098, 1) * 255)))
cam.End3D()
end
[/lua]

The sprite draws through walls. Same effect if I use render.DrawQuadEasy. Any ideas?

I believe all sprites draw though the map. Isn’t that why the light stool does that :v:

Well is there a fix I can try? Render.DrawQuadEasy returns similar results.