Skip to content

Commit

Permalink
Make sure lagged movement base speed is 1.0 on connect #371
Browse files Browse the repository at this point in the history
The global is zero initialized and all other spots in the code setting the base speed to `1.0` when it's `0.0` didn't seem to be enough.
  • Loading branch information
peace-maker committed Apr 16, 2022
1 parent f0b29cd commit 8986ba2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripting/smrpg_effects.sp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public void OnPluginStart()
// Account for late loading
for(int i=1;i<=MaxClients;i++)
{
if(IsClientConnected(i))
OnClientConnected(i);
if(IsClientInGame(i))
OnClientPutInServer(i);
}
Expand All @@ -68,6 +70,11 @@ public void OnMapStart()
ReadLimitDamageConfig();
}

public void OnClientConnected(int client)
{
InitLaggedMovementClient(client);
}

public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_OnTakeDamage, Hook_OnTakeDamage);
Expand Down
5 changes: 5 additions & 0 deletions scripting/smrpg_effects/laggedmovement.sp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ void RegisterLaggedMovementForwards()
g_hfwdOnClientLaggedMovementReset = CreateGlobalForward("SMRPG_OnClientLaggedMovementReset", ET_Ignore, Param_Cell, Param_Cell);
}

void InitLaggedMovementClient(int client)
{
g_ClientMovementState[client].base = 1.0;
}

void ResetLaggedMovementClient(int client, bool bDisconnect)
{
if(IsClientInGame(client))
Expand Down

0 comments on commit 8986ba2

Please sign in to comment.