diff --git a/RaceTimer/scripting/unloze_racetimer_redux.sp b/RaceTimer/scripting/unloze_racetimer_redux.sp index f54d66aa..a1503cf7 100644 --- a/RaceTimer/scripting/unloze_racetimer_redux.sp +++ b/RaceTimer/scripting/unloze_racetimer_redux.sp @@ -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: