First Stencil Failure

So I finally thought I understood stencils and tried making a function myself. It’s supposed to draw props behind walls but not in front of them. Can anyone tell me what I did wrong?


hook.Add("PostDrawOpaqueRenderables", "test", function()
for k, v in pairs(ents.FindByClass("prop_physics")) do
		
			render.ClearStencil()
			render.SetStencilEnable(true)
				render.SetStencilWriteMask(255)
				render.SetStencilTestMask(255)
				render.SetStencilReferenceValue(100)
				render.SetStencilFailOperation(STENCILOPERATION_REPLACE)
				render.SetStencilZFailOperation(STENCILOPERATION_REPLACE)
				render.SetStencilPassOperation(STENCILOPERATION_ZERO)
				render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL)
				v:DrawModel()
			render.SetStencilEnable(false)
		
end
end)

http://forum.facepunch.com/showthread.php?t=1461027&p=47541576&viewfull=1#post47541576

if you need any explaining about parts of that code, just ask here.

thank you