Original, unedited source-code for budding modders out there.
Originally created in order to aid those attempting to fix the 'SwapEndian' error with C++11 and later versions (link points to a question on Stack Overflow by me), but also because I keep losing the original source-code :-).
Feel free to fork and create your own game mod :-).
From the CryEngine Forums:
static void SvMaxPlayers(ICVar* cvar)
{
int value = cvar->GetIVal();
if (value < 2)
{
value=2;
cvar->Set(value);
return;
}
}
pConsole->GetCVar("sv_maxplayers")->SetOnChangeCallback(SvMaxPlayers);
Goes in GameCVars.cpp.