From c3c03f4e9580788482364f48911c56560f999915 Mon Sep 17 00:00:00 2001 From: christian Date: Tue, 20 Apr 2021 19:31:43 +0200 Subject: [PATCH] small updates --- AutismBotIngame/scripting/autism_bot_info.sp | 27 ++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index 4f19db49..bfe2d8e4 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -233,7 +233,7 @@ public Action bot_check_connect(Handle timer, any data) for (int i = 1; i <= MaxClients; i++) if (IsValidClient(i) && !IsFakeClient(i)) { - if (client_count > 61) + if (client_count > 60) { found_bot_1 = true; found_bot_2 = true; @@ -276,7 +276,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float if (is_bot_player(client)) { int flags = GetEntityFlags(client); - if (!(flags & FL_ONGROUND) && (flags_old[client] & FL_ONGROUND) && !(buttons_old[client] & IN_JUMP) && !(buttons & IN_JUMP) && (GetEntityMoveType(client) != MOVETYPE_LADDER)) + if (!(flags & FL_ONGROUND) && (flags_old[client] & FL_ONGROUND) && !(buttons_old[client] & IN_JUMP) && !(buttons & IN_JUMP) && (GetEntityMoveType(client) != MOVETYPE_LADDER) && GetEntProp(client, Prop_Data, "m_nWaterLevel") == 0) { float Vel[3], feet_origin[3], ground_pos[3], downwards[3]; //TODO @@ -421,7 +421,8 @@ public Action recursive_pressing(Handle timer, any data) } else if (IsValidClient(targethuman[client])) face_call(targethuman[client], client); - trace_hulling_bot(client); + if (GetEntProp(client, Prop_Data, "m_nWaterLevel") == 0) + trace_hulling_bot(client); char message[generic_length * 7]; if (IsValidClient(targethuman[client])) Format(message, sizeof(message), "dist_target: %f targethuman: %N enemy_distance: %f targeteam: %i", dist_target, targethuman[client], enemy_distance, targeteam); @@ -700,8 +701,6 @@ public int GetClosestClient_option1(int targeteam, int client) continue; } } - 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); @@ -709,12 +708,30 @@ public int GetClosestClient_option1(int targeteam, int client) dist_target += 7500; else if (admins[i] || vips[i] || i == target_enemy[client]) dist_target /= 5; + if (i == targethuman[client]) + dist_target /= 5; if (nearestdistance < 0 || dist_target < nearestdistance) { nearest = i; nearestdistance = dist_target; } } + if (nearest == -1) + { + for (int i = 1; i <= MaxClients; i++) + if (IsValidClient(i) && IsPlayerAlive(i) && i != client && GetClientTeam(i) == targeteam) + { + float pos[3]; + GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos); + float dist_target = get_power_distance(client, pos); + if (nearestdistance < 0 || dist_target < nearestdistance) + { + nearest = i; + nearestdistance = dist_target; + } + + } + } return nearest; }