cam.IgnoreZ not properly working

I’m trying to get a simple lua wallhack working that would allow me to see players through walls
Afaik, coding lua clientside cheats isn’t bad, tell me if the TOS doesn’t say so (where is the TOS by the way?)

Here’s my code
[lua]

local function ColorFromHealth(ply)
local max_health_div = 50
local cur_health = ply:Health()
if cur_health < max_health_div then
local i = 255cur_health/max_health_div
return Color(255, i, 0)
elseif cur_health > max_health_div then
local i = 255
(max_health_div-cur_health)/max_health_div
return Color(i, 255, 0)
else
return Color(255, 255)
end
end

local white_material = Material(“models/debug/debugwhite”)

hook.Add(“RenderScreenspaceEffects”, “RenderDerpBlabla”, function()

local mode = derp:CV("wallhack_mode"):GetInt()
if derp:CV("wallhack_enabled"):GetBool() and (mode == 2 or mode == 3) then

	cam.Start3D(EyePos(), EyeAngles())
	
	for k,v in pairs(player.GetAll()) do
		local trace = {
			start = LocalPlayer():GetShootPos(),
			endpos = v:GetHeadPos(),
			mask = MASK_SHOT
		}
		trace = util.TraceLine(trace)
		if trace.Entity != v then
			if v != LocalPlayer() and (v:GetPos():Distance(LocalPlayer():GetPos()) &lt; radius) then
				local t
				if mode == 2 then
					t = team.GetColor(v:Team())
				else
					t = ColorFromHealth(v)
				end
				local c = { t.r/255, t.g/255, t.b/255 }
				render.MaterialOverride(white_material)
				render.SetColorModulation(unpack(c))
				render.SuppressEngineLighting(true)
				cam.IgnoreZ(true) -- the problem is here
				v:DrawModel()
				render.MaterialOverride(0)
				render.SetColorModulation(1,1,1)
				render.SuppressEngineLighting(false)
				cam.IgnoreZ(false)
			end
		end	
	end
	
	cam.End3D()
	
end

end)
[/lua]

I need cam.IgnoreZ, but when I use all players are dark, whatever I set render.SetColorModulation to. Ideas?

I’ve had this issue while applying halo with IgnoreZ = true to entities.
Worked fine with props, but entities were turning all black.

Thanks, using this code
[lua]
for k,v in pairs(hook.GetTable().PreDrawHalos) do
hook.Remove(“PreDrawHalos”, k)
end
[/lua]
Fixed it. I guess it’s a bug, someone with a Github account should report it (cam.IgnoreZ not working with PreDrawHalos).

[lua]
white = g.CreateMaterial(“WhiteMaterial”,“UnlitGeneric”,{
["$basetexture"] = “models/debug/debugwhite”,
["$ignorez"] = 1
})

cam.Start3D(EyePos(),EyeAngles());
render.MaterialOverride(white);

render.SetColorModulation(t.r/255,t.g/255,t.b/255);
render.SetBlend(t.a/255);

v:DrawModel();
render.MaterialOverride(nil);

cam.End3D();
[/lua]
Less intrusive work-around?

Thanks, I didn’t know about the $ignorez parameter of materials. But cam.IgnoreZ() should still be fixed I think.