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)
|
public int GetClosestClient_option1(int targeteam)
|
||||||
{
|
{
|
||||||
bool admin_or_vip_targets = false;
|
|
||||||
float nearestdistance = -1.0;
|
float nearestdistance = -1.0;
|
||||||
int nearest = -1;
|
int nearest = -1;
|
||||||
for (int i = 1; i <= MaxClients; i++)
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == targeteam && i != present)
|
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))
|
if (!IsAbleToSee(present, i))
|
||||||
continue;
|
continue;
|
||||||
if (is_client_stuck_or_afk(i))
|
if (is_client_stuck_or_afk(i))
|
||||||
@ -456,6 +443,8 @@ public int GetClosestClient_option1(int targeteam)
|
|||||||
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(present, pos);
|
float dist_target = get_power_distance(present, pos);
|
||||||
|
if (admins[i] || vips[i])
|
||||||
|
dist_target /= 5;
|
||||||
if (nearestdistance < 0 || dist_target < nearestdistance)
|
if (nearestdistance < 0 || dist_target < nearestdistance)
|
||||||
{
|
{
|
||||||
nearest = i;
|
nearest = i;
|
||||||
|
Loading…
Reference in New Issue
Block a user