minor change with big changes for targeting
This commit is contained in:
parent
c19acc597b
commit
c17175d0b2
@ -431,24 +431,11 @@ stock bool is_client_stuck_or_afk(int client)
|
||||
|
||||
public int GetClosestClient_option1(int targeteam)
|
||||
{
|
||||
bool admin_or_vip_targets = false;
|
||||
float nearestdistance = -1.0;
|
||||
int nearest = -1;
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == targeteam && i != present)
|
||||
{
|
||||
if (admins[i] || vips[i])
|
||||
{
|
||||
admin_or_vip_targets = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == targeteam && i != present)
|
||||
{
|
||||
if (admin_or_vip_targets)
|
||||
if (!admins[i] && !vips[i])
|
||||
continue;
|
||||
if (!IsAbleToSee(present, i))
|
||||
continue;
|
||||
if (is_client_stuck_or_afk(i))
|
||||
@ -456,11 +443,13 @@ public int GetClosestClient_option1(int targeteam)
|
||||
float pos[3];
|
||||
GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos);
|
||||
float dist_target = get_power_distance(present, pos);
|
||||
if (admins[i] || vips[i])
|
||||
dist_target /= 5;
|
||||
if (nearestdistance < 0 || dist_target < nearestdistance)
|
||||
{
|
||||
nearest = i;
|
||||
nearestdistance = dist_target;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nearest;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user