I never worked much with CoD4, but in CoD2 it's just setcvar("foo", "test") and getcvar("foo")