HeelX,
ptr_first is not for ALL entities, it is for ALL objects OF THE SAME TYPE...

Take a look in the manual at the "handle" entry, and you'll see there are three
'different' types of entity. 'lobal', 'local', and 'layer'.

So if you wantr to find all "layer" entities (a view-entity), then you will
need to 'prime' the ptr-first function with another view-entiy.
You aren't, you are priming it with the "level_ent" whis is not a view-entity.

Try this instead (untested)....
Code:
...
   int ents = 0;
   ENTITY* seed = ent_createlocal(CUBE_MDL, nullvector, NULL);
   ENTITY* ent = ptr_first(seed);
   while (ent)
   {
      if(ent != seed)  //dont count the seed-entity
      {   ents++;   }
      ent = ent.link.next;
   }

   ent_remove(seed);
   printf("ents = %d", ents);
   //out: "ents = 0"

...





"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial