Raised This Month: $ Target: $400
 0% 

Removing ents with HAM


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 10-01-2009 , 08:02   Removing ents with HAM
Reply With Quote #1

Hi guys
I have another problem with ents -.-
Look the code:
PHP Code:
#include <amxmodx>
#include <engine>
#include <hamsandwich>

new const g_remove_entities[][] = 

    
"func_bomb_target",    
    
"info_bomb_target"
    
"hostage_entity",      
    
"monster_scientist"
    
"func_hostage_rescue"
    
"info_hostage_rescue",
    
"info_vip_start",      
    
"func_vip_safetyzone"
    
"func_escapezone",     
    
"func_buyzone"
}

public 
plugin_init() {
     for(new 
0;sizeof g_remove_entities;i++)
        
RegisterHam(Ham_Spawng_remove_entities[i], "fw_RemoveEnts")
}

public 
fw_RemoveEnts(ent)
{
    if(
is_valid_ent(ent))
        
remove_entity(ent)

The problem:
Do not remove the entities :S

Question:
What am I doing wrong?
__________________
alan_el_more is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-01-2009 , 08:08   Re: Removing ents with HAM
Reply With Quote #2

Register them in precache().
__________________
Arkshine is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-01-2009 , 08:17   Re: Removing ents with HAM
Reply With Quote #3

Also you dont need if(is_valid_ent(ent))
__________________
xPaw is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 10-01-2009 , 08:47   Re: Removing ents with HAM
Reply With Quote #4

If I do that I can not choose teams -.-
__________________
alan_el_more is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-01-2009 , 08:49   Re: Removing ents with HAM
Reply With Quote #5

Because Ham sucks :p ; use FM_Spawn
__________________
Arkshine is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 10-01-2009 , 09:01   Re: Removing ents with HAM
Reply With Quote #6

Thanks arkshine
__________________
alan_el_more is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-01-2009 , 09:07   Re: Removing ents with HAM
Reply With Quote #7

Someone has already talked about that ( there is a thread somewhere by xPaw If I'm right ), it's because Ham will spawn all entities with the same internal class and not the classname. The player spawn entities and others entities related to the hostage ( don't remember which ) use the same internal class.

Using trie :

Code:
    #include <amxmodx>     #include <fakemeta>         new Trie:tEntities;     new gFwdId;         public plugin_precache ()     {         new const EntitiesToRemove[][] =         {             "func_bomb_target"   , "info_bomb_target",             "hostage_entity"     , "monster_scientist",             "func_hostage_rescue", "info_hostage_rescue",             "info_vip_start"     , "func_vip_safetyzone",             "func_escapezone"    , "func_buyzone"         }                 for ( new i = 0; i < sizeof EntitiesToRemove; i++ )         {             TrieSetCell( tEntities, EntitiesToRemove[ i ], true );         }                 gFwdId = register_forward( FM_Spawn, "Foward_Spawn" );     }         public Foward_Spawn( const Entity )     {         new ClassName[ 32 ];         pev( Entity, pev_classname, ClassName, charsmax( ClassName ) );             if ( TrieKeyExists( tEntities, ClassName ) )         {             engfunc( EngFunc_RemoveEntity, Entity );         }     }         public plugin_init ()     {         unregister_forward( FM_Spawn, gFwdId );         TrieDestroy( tEntities );     }
__________________
Arkshine is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-01-2009 , 10:36   Re: Removing ents with HAM
Reply With Quote #8

Quote:
Originally Posted by Arkshine View Post
Someone has already talked about that ( there is a thread somewhere by xPaw If I'm right ), it's because Ham will spawn all entities with the same internal class and not the classname. The player spawn entities and others entities related to the hostage ( don't remember which ) use the same internal class.
It was me!

http://forums.alliedmods.net/showthread.php?t=102400
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-01-2009 , 10:44   Re: Removing ents with HAM
Reply With Quote #9

Quote:
Originally Posted by Exolent[jNr] View Post
Lies, it was me!

http://forums.alliedmods.net/showthread.php?t=93624
__________________
xPaw is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-01-2009 , 10:45   Re: Removing ents with HAM
Reply With Quote #10

Quote:
Originally Posted by xPaw View Post
Mine is almost the exact same as the topic, yours is just water.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:31.


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