I know what this code above does it should show you just the basic. Here is the mod which i meant above. It works without c_scan. I did not test it but i think it finds the nearest one. Use it fex. like this find_nearest(player); This should find the nearest you to player.
// -------------------------------------------------------------------------------------------------------------------------------------------------
function find_nearest(ENTITY* ent)
{
var you_handle;
var _dist=1000;
var _ndist;
var dist_to_nearest;
// repeat for all entities
for(you = ent_next(NULL); you; you = ent_next(you))
{
if(you.skill2 == 1)
{
_ndist = vec_dist(ent.x, you.x);
if (_ndist < _dist) { _dist = _ndist; you_handle = handle(you); }
}
}
dist_to_nearest = _dist; //nearest entity to "ent"
you = ptr_for_handle(you_handle); //you to nearest found
}
// -------------------------------------------------------------------------------------------------------------------------------------------------
Last edited by rayp; 07/31/12 22:59.
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|