Fix the ping reducer changing clientside cmdrate
This commit is contained in:
parent
0b8c403293
commit
a15bee2b9c
@ -295,15 +295,21 @@ void CreateMove()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int ping = g_pPlayerResource->GetPing(g_IEngine->GetLocalPlayer());
|
int ping = g_pPlayerResource->GetPing(g_IEngine->GetLocalPlayer());
|
||||||
if (*force_ping <= ping && cmdrate->GetInt() != -1)
|
static Timer updateratetimer{};
|
||||||
|
if (updateratetimer.test_and_set(500))
|
||||||
|
{
|
||||||
|
if (*force_ping <= ping)
|
||||||
{
|
{
|
||||||
oldCmdRate = cmdrate->GetInt();
|
oldCmdRate = cmdrate->GetInt();
|
||||||
cmdrate->m_fMaxVal = 999999999.9f;
|
NET_SetConVar command("cl_cmdrate", "-1");
|
||||||
cmdrate->m_fMinVal = -999999999.9f;
|
((INetChannel *) g_IEngine->GetNetChannelInfo())->SendNetMsg(command);
|
||||||
cmdrate->SetValue(-1);
|
|
||||||
}
|
}
|
||||||
else if (*force_ping > ping)
|
else if (*force_ping > ping)
|
||||||
cmdrate->SetValue(oldCmdRate);
|
{
|
||||||
|
NET_SetConVar command("cl_cmdrate", std::to_string(oldCmdRate).c_str());
|
||||||
|
((INetChannel *) g_IEngine->GetNetChannelInfo())->SendNetMsg(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user