fixing errors due to disconnected clients

This commit is contained in:
Christian 2021-02-26 22:31:47 +01:00
parent 7d90cb64ae
commit 0c2103cc0c

View File

@ -104,7 +104,6 @@ public void SQL_OnConnectFinished(Database db, DBResultSet results, const char[]
return;
}
for(int i = 1; i <= MaxClients; i++)
if (IsClientConnected(i) && IsClientAuthorized(i))
OnClientPostAdminCheck(i);
}
@ -287,19 +286,27 @@ public void OnClientDisconnect(int client)
//----------------------------------------------------------------------------------------------------
public void resetClient(int client)
{
g_iClientChecking[client] = 0;
g_bHumansAllowedTime[client] = false;
resetClientVectors(client);
player_stage[client] = 0;
Format(g_csTime_record[client], sizeof(g_csTime_record[]), "0.000");
if (IsClientConnected(client) && IsClientAuthorized(client))
{
g_iClientChecking[client] = 0;
g_bHumansAllowedTime[client] = false;
resetClientVectors(client);
player_stage[client] = 0;
Format(g_csTime_record[client], sizeof(g_csTime_record[]), "0.000");
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float vel[3], const float angles[3], int weapon, int subtype, int cmdnum, int tickcount, int seed, const int mouse[2])
{
if (!IsValidClient(client))
return;
if (g_bEventBool)
{
g_bHumansAllowedTime[client] = false;
return;
}
if (g_bHumansAllowedTime[client] && (GetClientTeam(client) == CS_TEAM_CT) && IsPlayerAlive(client))
{
@ -381,9 +388,12 @@ public float client_current_race_time(int i_client)
//----------------------------------------------------------------------------------------------------
public void resetClientVectors(int client)
{
g_fClientVectors[client][0] = 0.000000;
g_fClientVectors[client][1] = 0.000000;
g_fClientVectors[client][2] = 0.000000;
if (IsClientConnected(client) && IsClientAuthorized(client))
{
g_fClientVectors[client][0] = 0.000000;
g_fClientVectors[client][1] = 0.000000;
g_fClientVectors[client][2] = 0.000000;
}
}
//----------------------------------------------------------------------------------------------------
// Purpose: