Catch All Cvar Changes

Which hook or function can I use to catch every cvar and output text for it. The one I posted below seems most logical but theres no example and it does not look to be like anything I am looking for. My best idea is a loop but I am not sure how I would get all the cvars.



Yea I had a look at that one also, I am trying to work it so I can apply that to every cvar so I can use my chattext function to print pretty text saying a cvar was changed, I know blackops has it for his chatbox but I am not sure how he got it for them all.

[lua]local oldfunction = cvars.OnConVarChanged – Keep a reference to the regular OnConVarChanged

cvars.OnConVarChanged = function( name, oldvalue, newvalue ) – Define your own version of it which the engine will call with the usual arguments

-- Do your stuff here

oldfunction( name, oldvalue, newvalue ) -- And then pass the arguments supplied by the engine to the old function so that is ran normally.


Thanks a lot man, works perfectly.

Edit: Two questions, should I put this server side or clientside it seems to work on both. And some commands arnt passed through such as sv_voiceenable and sometimes sv_cheats doesn’t show.

cvars.OnConVarChanged = function( name, oldvalue, newvalue )
chat.AddText( ply, Color( 26, 188, 60 ), “[SSA]”, Color( 255, 255, 255 ), " ConVar ", Color( 124, 124, 124 ), name, Color( 255, 255, 255 ), " was changed to ", Color( 124, 124, 124 ), newvalue, Color( 255, 255, 255 ), “!” )