I know what you meant by sm_cvar z_difficulty ect....
It's what you said here:
I should also point out that if you use the lobby system, your difficulty will be set correctly every time. Why not just force your server from lobby instead of direct connecting + setting z_difficulty?