diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index 19af74b8..8b9bd3bd 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -13,7 +13,7 @@ #include #include -int target_friend_afk_counter[MAXPLAYERS + 1]; +int target_friend_afk_counter[MAXPLAYERS][MAXPLAYERS + 1]; int target_friend[MAXPLAYERS + 1]; int target_enemy[MAXPLAYERS + 1]; int buttons_old[MAXPLAYERS + 1]; @@ -824,13 +824,13 @@ stock bool IsValidClient(int client) return false; } -stock bool is_client_stuck_or_afk(int client) +stock bool is_client_stuck_or_afk(int client, int i) { //can trigger between 6-8 times per second - target_friend_afk_counter[client]++; - if (target_friend_afk_counter[client] > 24) + target_friend_afk_counter[client][i]++; + if (target_friend_afk_counter[client][i] > 24) { - target_friend_afk_counter[client] = 0; + target_friend_afk_counter[client][i] = 0; float min_distance_cap = 1.0; float client_own_distance = get_power_distance(client, client_old_coords[client]); GetEntPropVector(client, Prop_Send, "m_vecOrigin", client_old_coords[client]); @@ -848,7 +848,7 @@ public int GetClosestClient_option1(bool finding_friend, int client) for (int i = 1; i <= MaxClients; i++) if (IsValidClient(i) && IsPlayerAlive(i) && i != client && !is_bot_player(i)) { - if (!IsAbleToSee(client, i) || is_client_stuck_or_afk(i)) + if (!IsAbleToSee(client, i) || is_client_stuck_or_afk(client, i)) { continue; } @@ -879,7 +879,11 @@ public float get_power_distance(int target_player, float [3]pos) public void OnClientPostAdminCheck(int client) { - target_friend_afk_counter[client] = 0; + for (int i = 1; i <= MaxClients; i++) + { + if (IsValidClient(i) && is_bot_player(i) && i != client) + target_friend_afk_counter[i][client] = 0; + } bot_avoid_edge[client] = -1; char auth[64]; GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth)); @@ -947,7 +951,11 @@ public void OnClientDisconnect(int client) client_old_coords[client][0] = 0.0; client_old_coords[client][1] = 0.0; client_old_coords[client][2] = 0.0; - target_friend_afk_counter[client] = 0; + for (int i = 1; i <= MaxClients; i++) + { + if (IsValidClient(i) && is_bot_player(i) && i != client) + target_friend_afk_counter[i][client] = 0; + } } //Socket callback