tbh, just have your pickups trigger some trigger_counter. and have the trigger_counter killtarget some func_wall.
conditions inside spawnfunctions other than to check the fields the mapper specified are generally pointless. anything that checks other entities inside the spawn function itself is stupid, as the entities that it refers to are not always going to have been spawned yet.
what your code is trying to do is check to see if the player has grabbed any items before any players are even on the map. and ONLY before there are players on the map. you'd need a think function... or you can just use the trigger mechanism that I already mentioned.