Check if entity exists?

Please post any questions about developing your plugin here. Please use the search function before posting!
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Check if entity exists?

Postby stonedegg » Tue Mar 31, 2015 11:57 am

Is there a way to check if an entity still exists without using EntityIter()?
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Tue Mar 31, 2015 12:01 pm

From what type?
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Postby stonedegg » Tue Mar 31, 2015 1:24 pm

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()?
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Tue Mar 31, 2015 1:56 pm

Syntax: Select all

if <BaseEntity>.is_free():
# Entity is no longer valid...
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Postby stonedegg » Tue Mar 31, 2015 2:05 pm

Thanks :)

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 145 guests