LagCompensation: fix turning off lagcomp

This commit is contained in:
BotoX 2020-01-04 17:55:34 +01:00
parent c84f602ee4
commit f7fc48a874

View File

@ -763,15 +763,18 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
if(!IsPlayerAlive(client)) if(!IsPlayerAlive(client))
return Plugin_Continue; return Plugin_Continue;
if(g_bDisableLagComp[client])
return Plugin_Continue;
// -1 because the newest record in the list is one tick old // -1 because the newest record in the list is one tick old
// this is because we simulate players first // this is because we simulate players first
// hence no new entity record was inserted on the current tick // hence no new entity record was inserted on the current tick
int iGameTick = GetGameTickCount() - 1; int iGameTick = GetGameTickCount() - 1;
int iDelta = iGameTick - tickcount; int iDelta = iGameTick - tickcount;
// The user is stupid and doesn't want lag compensation.
// To get the original behavior back lets assume they actually have 0 latency.
if(g_bDisableLagComp[client])
iDelta = 0;
if(iDelta < 0) if(iDelta < 0)
iDelta = 0; iDelta = 0;