Better to return -1 in Spawn forward then removing the entity.
Also, you don't need to remove all those entity, see in followinf example which ones are needed.
End, you could use a Trie for those classes.
PHP Code:
new Trie:g_tRemoveEntClasses;
new g_iFhDispatchSpawn;
public plugin_precache()
{
new szRemoveEntClasses[][] =
{
"func_bomb_target", "info_bomb_target", // de_
"func_hostage_rescue", // cs_
"func_escapezone", // es_
"func_vip_safetyzone", // as_
};
g_tRemoveEntClasses = TrieCreate();
for(new i; i<sizeof(szRemoveEntClasses); i++)
{
TrieSetCell(g_tRemoveEntClasses, szRemoveEntClasses[i], 1);
}
g_iFhDispatchSpawn = register_forward(FM_Spawn, "OnDispatchSpawn", 0);
}
public OnDispatchSpawn( ent )
{
new classname[32];
pev(ent, pev_classname, classname, charsmax(classname));
if( TrieKeyExists(g_tRemoveEntClasses, classname) )
{
forward_return(FMV_CELL, -1);
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
public plugin_init()
{
unregister_forward(g_iFhDispatchSpawn);
TrieDestroy(g_tRemoveEntClasses);
}
__________________