Something like this might work, and it'd be more efficient since it's not going to try and retrieve 2000 clients.
Code:
my @clientlist = $entity_list->GetClientList();
foreach $ent (@clientlist)
{
my $x = $npc->GetX();
my $y = $npc->GetY();
my $z = $npc->GetZ();
my $distanceCHK = $ent->CalculateDistance($x, $y, $z);
my $PLTarget = $npc->GetTarget();
my $TargID = $PLTarget->GetID();
my $ClID = $ent->GetID();
my $RampDamageVar = (int(rand($DamageVar ))) + (int($ShieldMinDam));
if (($distanceCHK <= 2000) && ($TargID != $ClID))
{
$ent->Damage($npc, $RampDamageVar, 7477, 1, true, -1, false);
$ent->Message(13, "$cmname hits YOU for $RampDamageVar points of damage!");
}
}