So I'm using the code below and it's deleting ALL the molecules at once.

Code:
function RemoveMolecules()
{
	while(NoOfMolecules != (n + 1))
	{
		you = ent_next(NULL);
		while(you)
		{
			ENTITY* PointAndKill = you;
			you = ent_next(you);
			
			if(PointAndKill.skill51 == 3619)
			{								
				NoOfMolecules = NoOfMolecules - 1;
				ptr_remove(PointAndKill);
			}
			wait(1);
		}
	}
}



I'm not sure what I'm doing wrong. The entire application can be found at https://www.dropbox.com/sh/85xl9xl2fv6ds9k/3-RS95REnK. I have poor internet reception right now so I don't think the dropbox files will be up to date, but if you copy and paste the function above into the code and assign it to a keyboard shortcut, you can recreate the problem. Maybe someone can find a solution before I do. Thanks again guys. P.S: My project deadline is 2pm tomorrow (Friday, April 11)

Last edited by rayp; 04/12/14 00:21. Reason: added code tags ... press edit to see how its done