slight change to targeting

This commit is contained in:
christian 2021-04-10 09:43:39 +02:00
parent a27f0fa888
commit 7f7bfb5e80

View File

@ -681,6 +681,17 @@ 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) && GetClientTeam(i) == targeteam && i != client)
{
@ -698,6 +709,8 @@ public int GetClosestClient_option1(int targeteam, int client)
continue;
}
}
if (bot_alternative && is_bot_player(i))
continue;
if (i == targethuman[client])
return targethuman[client];
float pos[3];