diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index 90e6449c..4f19db49 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -13,6 +13,7 @@ #include //#pragma newdecls required +int target_human_afk_counter[MAXPLAYERS + 1]; int targethuman[MAXPLAYERS + 1]; int target_enemy[MAXPLAYERS + 1]; int buttons_old[MAXPLAYERS + 1]; @@ -408,7 +409,7 @@ public Action recursive_pressing(Handle timer, any data) GetEntPropVector(target_enemy[client], Prop_Send, "m_vecOrigin", pos); enemy_distance = get_power_distance(client, pos); } - if ((250 > enemy_distance && targeteam == 2) || dist_target < 0 < enemy_distance) + if ((250 > enemy_distance > 0 && targeteam == 2) || dist_target < 0 < enemy_distance) { /* float feet_origin[3], enemy_feet_origin[3]; @@ -678,65 +679,36 @@ stock bool is_client_stuck_or_afk(int client) return client_own_distance < min_distance_cap; } -int target_human_afk_counter = 0; public int GetClosestClient_option1(int targeteam, int client) { float nearestdistance = -1.0; int nearest = -1; - bool bot_alternative = false; - for (int i = 1; i <= MaxClients; i++) - if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == targeteam && !is_bot_player(i)) - { - /*if (!IsAbleToSee(client, i)) - continue;*/ - if (is_client_stuck_or_afk(i)) - continue; - bot_alternative = true; - break; - } for (int i = 1; i <= MaxClients; i++) if (IsValidClient(i) && IsPlayerAlive(i) && i != client && GetClientTeam(i) == targeteam) { - /* if (!IsAbleToSee(client, i)) continue; - */ if (is_client_stuck_or_afk(i)) { if (i != targethuman[client]) continue; - target_human_afk_counter++; - int afk_cap = 9; - if (target_human_afk_counter > afk_cap) + target_human_afk_counter[client]++; + int afk_cap = 4; + if (target_human_afk_counter[client] > afk_cap) { - target_human_afk_counter = 0; + target_human_afk_counter[client] = 0; continue; } } - if (bot_alternative && is_bot_player(i)) - continue; - /* - if (i == targethuman[client]) - return targethuman[client];*/ + if (i == targethuman[client] && !is_bot_player(i)) + return targethuman[client]; float pos[3]; GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos); float dist_target = get_power_distance(client, pos); - if (admins[i] || vips[i] || i == target_enemy[client]) + if (is_bot_player(i)) + dist_target += 7500; + else if (admins[i] || vips[i] || i == target_enemy[client]) dist_target /= 5; - if (GetClientTeam(client) == 3 && targeteam == 3) - { - for (int j = 1; j <= MaxClients; j++) - if (IsValidClient(j) && IsPlayerAlive(j) && GetClientTeam(j) == 2) - { - /* - if (!IsAbleToSee(i, j)) - continue; - */ - if (is_client_stuck_or_afk(j)) - continue; - dist_target += 250.0; - } - } if (nearestdistance < 0 || dist_target < nearestdistance) { nearest = i; @@ -759,6 +731,7 @@ public void OnClientPostAdminCheck(int client) //STEAM_0:1:60189040 //[U:1:120378081] //[U:1:69566635] + target_human_afk_counter[client] = 0; char auth[50]; GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth)); char msg[generic_length]; @@ -806,6 +779,7 @@ 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_human_afk_counter[client] = 0; } //Socket callback