I haven’t written for a while, mainly because I’ve been busy with classes and studying for the GRE for my grad school applications, but here’s a quick tip for those of you meddling around with the Source SDK.
It’s well documented on how you go about spawning entities, but I couldn’t find a good place explaining how to remove spawned entities through code.
Don’t try meddling with the global entity list (gEntList) or calling its RemoveEntity() method. It doesn’t do what you want.
Instead, used one of the super-handy UTIL_* functions. Given a pointer to the entity you want to remove, simply use:
UTIL_Remove(pEntity);
Poof. Entity gone. Remember, entities are created and destroyed on the server side only. The server will automatically broadcast any changes to the entity list to its connected clients for you.