Need help with cvars.AddChangeCallback

I have been doing some tests with cvars.AddChangeCallback and I came across a really weird bug, for some reason whenever I try putting this:



if newValue == 1 then


It doesn’t call anything after it. The weird part is when I do this:



print(newValue)


It print 1 or 0, so the problem is why wont it work when I put it like this:



if newValue == 1 then


Here is the full code:



cvars.AddChangeCallback("vj_npc_drvrejfriendly",function(convar_name,oldValue,newValue)
	//print(newValue)
	if newValue == 1 then
		print("They no longer detect DrVrej!")
		for k,v in pairs(ents.GetAll()) do
		if v:IsPlayer() && v:SteamID() == "STEAM_0:0:22688298" then 
		v:SetNoTarget(true)
		end
	 end
	end
	if newValue == 0 then
		print("They now detect DrVrej!")
		for k,v in pairs(ents.GetAll()) do
		if v:IsPlayer() && v:SteamID() == "STEAM_0:0:22688298" then 
		v:SetNoTarget(false)
		end
	 end
	end
end)


Thanks for the help!

It’s a string afaik. Put “1” or add tonumber.

I forgot about that, thanks.