I created a function to list the dead clients and order the closest distance and put it in an array. then I create a new array and assign the return function value to the new array to use for other purposes
Quote:
stock ArrayList ClientSurDieInRange(int victimdie, float radius, float origin[3])
{
float vecOTargetDie[3], vecOTargetDie_i[3],vecOTargetDie_j[3];
int count_cd,tmp_client;
ArrayList l_iclients = ArrayList();
for(new i=1; i<=MaxClients; i++)
{
if (IsClientSurDie(i) && i!=victimdie)
{
GetClientAbsOrigin(i, vecOTargetDie);
if (GetVectorDistance(origin,vecOTargetDie) <= radius)
{
l_iclients.push(i);
}
}
}
for(new i=0; i < l_iclients.length; i++)
{
GetClientAbsOrigin(l_iclients[i], vecOTargetDie_i);
for(new j=i+1; j<l_iclients.length; j++)
{
GetClientAbsOrigin(l_iclients[j], vecOTargetDie_j);
if(GetVectorDistance(origin,vecOTargetDie_j) < GetVectorDistance(origin,vecOTargetDie_i))
{
tmp_client = l_iclients[i];
l_iclients[i]=l_iclients[j];
l_iclients[j]=tmp_client;
}
}
}
return l_iclients;
}
|
Quote:
ArrayList clientsInRange = ClientSurDieInRange(victimdie, radius, origin);
|
then I create a new ArrayList variable and assign the return function value but get an error. Maybe my syntax is wrong somewhere, can someone help me?
__________________