I dont know exactly why it doesnt stop when the counter reachs 5, but to solve the problem, try to leave the while after your counter reaches 5.

if(entity_counter >= 5)
{
break;
}

put this within your while loop should work for you.
Hope this helps.

cheers

Last edited by zwecklos; 02/25/08 16:00.