This is pretty subtle. Basically, there’s many different ways to set console vars in UE4: .ini files, Editor settings, C++ code, debug console in-game, etc. Because of this, users/developers sometimes set conflicting values on the same console variable.
UE4 solves this problem by assigning different priorities to each method. For example, say you set your resolution to X1,Y1 in C++ code. Later, you try to r.SetRes to X2,Y2 in the in-game console (or the PlayerController->ConsoleCommand function, which is equivalent). Your call to r.SetRes will fail, because console variables set through C++ code take priority over those set using the in-game console.
You can see a comprehensive list of the different priorities here: https://docs.unrealengine.com/latest/INT/Programming/Development/Tools/ConsoleManager/index.html#priority
You’ll probably want to do something like this instead:
IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SetRes"));
CVar->Set(res);
This will allow you to access and update the r.SetRes console variable directly, with the same priority as other C++ code.