small updates

This commit is contained in:
christian 2021-04-20 19:31:43 +02:00
parent 5ee4993df9
commit c3c03f4e95

View File

@ -233,7 +233,7 @@ public Action bot_check_connect(Handle timer, any data)
for (int i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
if (IsValidClient(i) && !IsFakeClient(i)) if (IsValidClient(i) && !IsFakeClient(i))
{ {
if (client_count > 61) if (client_count > 60)
{ {
found_bot_1 = true; found_bot_1 = true;
found_bot_2 = 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)) if (is_bot_player(client))
{ {
int flags = GetEntityFlags(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]; float Vel[3], feet_origin[3], ground_pos[3], downwards[3];
//TODO //TODO
@ -421,7 +421,8 @@ public Action recursive_pressing(Handle timer, any data)
} }
else if (IsValidClient(targethuman[client])) else if (IsValidClient(targethuman[client]))
face_call(targethuman[client], 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]; char message[generic_length * 7];
if (IsValidClient(targethuman[client])) 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); 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; continue;
} }
} }
if (i == targethuman[client] && !is_bot_player(i))
return targethuman[client];
float pos[3]; float pos[3];
GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos); GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos);
float dist_target = get_power_distance(client, pos); float dist_target = get_power_distance(client, pos);
@ -709,12 +708,30 @@ public int GetClosestClient_option1(int targeteam, int client)
dist_target += 7500; dist_target += 7500;
else if (admins[i] || vips[i] || i == target_enemy[client]) else if (admins[i] || vips[i] || i == target_enemy[client])
dist_target /= 5; dist_target /= 5;
if (i == targethuman[client])
dist_target /= 5;
if (nearestdistance < 0 || dist_target < nearestdistance) if (nearestdistance < 0 || dist_target < nearestdistance)
{ {
nearest = i; nearest = i;
nearestdistance = dist_target; 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; return nearest;
} }