doesn't FindEntityInSphere return -1 on failure and not 0? Thus the while loop is non terminating. Try changing
Code:
while((ent = engfunc(EngFunc_FindEntityInSphere, ent, origin, range)) != 0)
to
Code:
while((ent = engfunc(EngFunc_FindEntityInSphere, ent, origin, range)) != -1)
__________________
If at first you don't succeed, then skydiving isn't for you.