Page 1 of 1

Check if entity exists?

Posted: Tue Mar 31, 2015 11:57 am
by stonedegg
Is there a way to check if an entity still exists without using EntityIter()?

Posted: Tue Mar 31, 2015 12:01 pm
by L'In20Cible
From what type?

Posted: Tue Mar 31, 2015 1:24 pm
by stonedegg
Any, but in my case I'm looking for hl2mp_ragdoll. I'm looking to do some delayed stuff on it, means I'm using the BaseEntity instance of a ragdoll and want to do stuff with it later. Problem is, if it's already removed, the server crashes.

Is there something similar to BaseEntity.exists or do I have to loop through EntityIter()?

Posted: Tue Mar 31, 2015 1:56 pm
by L'In20Cible

Syntax: Select all

if <BaseEntity>.is_free():
# Entity is no longer valid...

Posted: Tue Mar 31, 2015 2:05 pm
by stonedegg
Thanks :)