added extra delay to probably fix client crash when moving bots around

This commit is contained in:
jenz 2024-02-08 01:38:17 +01:00
parent cfcd2c5a9b
commit 8ef96b89ab

View File

@ -290,7 +290,7 @@ public Action ApplySettings(Event event, const char[] name, bool dontBroadcast)
} }
else if (IsFakeClient(client)) //bot getting respawned as zm else if (IsFakeClient(client)) //bot getting respawned as zm
{ {
SelectWaveBasedZM(client, 0); CreateTimer(1.0, Timer_delayedSelectWaveBasedZM, GetClientUserId(client));
} }
else else
{ {
@ -299,6 +299,17 @@ public Action ApplySettings(Event event, const char[] name, bool dontBroadcast)
return Plugin_Handled; return Plugin_Handled;
} }
public Action Timer_delayedSelectWaveBasedZM(Handle timer, any userid)
{
int client = GetClientOfUserId(userid);
if (!IsValidClient(client))
{
return Plugin_Handled;
}
SelectWaveBasedZM(client, 0);
return Plugin_Handled;
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -1081,7 +1092,7 @@ public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast
{ {
if (IsFakeClient(i)) if (IsFakeClient(i))
{ {
SelectWaveBasedZM(i, 0); CreateTimer(1.0, Timer_delayedSelectWaveBasedZM, GetClientUserId(i));
continue; continue;
} }
g_iClientRespawnCount[i] = g_iClientRespawnCountNum; //even if not spawned in yet it should be set for every real player. g_iClientRespawnCount[i] = g_iClientRespawnCountNum; //even if not spawned in yet it should be set for every real player.
@ -1524,9 +1535,23 @@ public Action SelectWaveBasedZM(int client, int state)
} }
} }
} }
//im just getting desperate at this point for fixing the client crash by adding random ass delays.
CreateTimer(1.0, Timer_delayedModelSelection, GetClientUserId(client));
return Plugin_Handled;
}
public Action Timer_delayedModelSelection(Handle timer, any userid)
{
int client = GetClientOfUserId(userid);
if (!IsValidClient(client) || !IsPlayerAlive(client))
{
return Plugin_Handled;
}
ModelSelection(client, 1, g_iClientZMClasses[client]); ModelSelection(client, 1, g_iClientZMClasses[client]);
return Plugin_Handled; return Plugin_Handled;
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------