From 84a2fc318f2759df66d84cd1f56c74652d27bda4 Mon Sep 17 00:00:00 2001 From: jenzur Date: Tue, 21 Jul 2020 02:09:41 +0200 Subject: [PATCH] preventing stuckness measures and focusing as zm changes --- AutismBotIngame/scripting/autism_bot_info.sp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index bad19b7a..4b7dea9f 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -14,6 +14,7 @@ int present = 0; int targethuman = 0; int client_out_balancer[MAXPLAYERS + 1]; +int bot_mini_count_stucker = 0; //admins & vips bool admins[MAXPLAYERS + 1]; @@ -197,12 +198,14 @@ public Action recursive_pressing(Handle timer, any data) if (IsValidClient(target_enemy)) { enemy_distance = get_power_distance(target_enemy, pos); + if (targeteam == 2) + enemy_cap = enemy_cap * 5; if (enemy_distance < enemy_cap) faceclient(target_enemy); } if (enemy_distance == -1.0 || enemy_distance > enemy_cap) faceclient(targethuman); - bot_stuck = is_client_stuck_or_afk(present); + bot_stuck = is_bot_stuck(); } Format(message, sizeof(message), "dist_target: %f targethuman: %N bot_on_type: %i enemy_distance: %f bot_stuck: %i", dist_target, targethuman, bot_on_type, enemy_distance, bot_stuck); send_socket_msg(message, strlen(message)); @@ -211,6 +214,21 @@ public Action recursive_pressing(Handle timer, any data) return Plugin_Continue; } +public bool is_bot_stuck() +{ + float flVel[3]; + GetEntPropVector(present, Prop_Data, "m_vecAbsVelocity", flVel); + if (flVel[0] < 10.0 && flVel[1] < 10.0) + bot_mini_count_stucker++; + else + bot_mini_count_stucker = bot_mini_count_stucker - 3; + if (bot_mini_count_stucker > 10) + bot_mini_count_stucker = 0; + if (bot_mini_count_stucker < 0) + bot_mini_count_stucker = 0; + return bot_mini_count_stucker > 9; +} + public void faceclient(int target_human) { float TargetPos[3];