This fuction is supposed to find an entity, but it finds the wrong one.
Maby there's a way to continue from 'ent' but i dunno how to stop the loop if nothing was found with classname 'my_classname' in specifyed sphere.
Funny thing is it worked before, and I can't remember me changing any of it.
Code:
stock FindEntAtOrigin(Float:fOrigin[3]) {
new classname[10], Float:fRadius, ent
while ( fRadius < 50.0 ) {
fRadius += 5.0
ent = engfunc(EngFunc_FindEntityInSphere, g_MaxPlayers, fOrigin, fRadius)
if ( ent ) {
pev(ent, pev_classname, classname, 9)
if ( equal(classname, "my_classname") )
return ent;
}
}
return 0;
}