AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [clarified] entities with owner delete themselves ? (https://forums.alliedmods.net/showthread.php?t=92430)

Hunter-Digital 05-15-2009 07:39

[clarified] entities with owner delete themselves ?
 
I get errors on disconnects that find_ent_by_owner() user's does not exist (doh, he just quit...) ... but, I want to know if entities that have owners delete themselves when the owner is gone ? if they don't I would make an alternative to find_ent_by_owner() to delete them...

hlstriker 05-15-2009 11:21

Re: entities with owner delete themselves ?
 
Quote:

Originally Posted by Hunter-Digital (Post 827824)
... but, I want to know if entities that have owners delete themselves when the owner is gone ?

No, entities with owners will stay in the game.

Hunter-Digital 05-15-2009 17:46

Re: entities with owner delete themselves ?
 
that sux, because upon disconnect I can't delete them easily using find_ent_by_owner(), I need to do a loop... anyway, It's possible so w/e

padilha007 05-15-2009 18:26

Re: entities with owner delete themselves ?
 
use pev_valid( owner )

ConnorMcLeod 05-15-2009 18:50

Re: entities with owner delete themselves ?
 
Quote:

Originally Posted by padilha007 (Post 828146)
use pev_valid( owner )

But find_ent_by_owner doesn't work, that's the point here ;)


You could save ents in an dynamic array, i mean a 33 array, in each cell a dynamic array that holds owner ents, then you can retrieve them easily on disconnect. There should be a better way, but that was just a coming idea :)

padilha007 05-15-2009 19:48

Re: entities with owner delete themselves ?
 
:oops:

Hunter-Digital 05-16-2009 15:31

Re: entities with owner delete themselves ?
 
Quote:

Originally Posted by ConnorMcLeod (Post 828157)
But find_ent_by_owner doesn't work, that's the point here ;)


You could save ents in an dynamic array, i mean a 33 array, in each cell a dynamic array that holds owner ents, then you can retrieve them easily on disconnect. There should be a better way, but that was just a coming idea :)

No, I just want to delete the ents when the owner disconnects... but I knew how it's done in the alternative way, I just wanted to know if it's required :}
PHP Code:

public client_disconnect(id)
{
     new 
ent = -1
 
     
while((ent find_ent_by_class(ent"ent_class")) != 0)
            if(
entity_get_edict(entEV_ENT_owner) == id)
                  
remove_entity(ent)
 
     
ent = -1
 
     
while((ent find_ent_by_class(ent"ent_class_two")) != 0)
            if(
entity_get_edict(entEV_ENT_owner) == id)
                  
remove_entity(ent)


end of topic :P


All times are GMT -4. The time now is 01:30.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.