Is there anyway to remove entities and unprecache their models before the map even load?
I look through the forum and only saw the unprecache part which only prevent from precaching but if the entity was in the map first then it will crash and return "Host_Error: no precache" error
Here is what I got so far.
PHP Code:
new const Remove_Obj[][] =
{
"custom_moodel1",
"custom_moodel2",
...
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
Remove_Ent()
}
public plugin_precache( )
{
register_forward( FM_PrecacheModel, "fw_PrecacheModel" )
}
public fw_PrecacheModel( const Model[ ] )
{
new Contain
for( new i = 0; i < sizeof( Remove_Obj ); i++ )
{
Contain = containi(Model, Remove_Obj[i])
if(Contain != -1)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
public Remove_Ent()
{
new const MAXENTS = get_global_int(GL_maxEntities)
new Model[64]
new Count, Contain
for(new ent = 1; ent < MAXENTS; ent++)
{
for( new i = 0; i < sizeof( Remove_Obj ); i++ )
{
if (!is_valid_ent(ent))
continue
pev(ent, pev_model, Model, charsmax(Model))
Contain = contain(Model, Remove_Obj[i])
if(Contain != -1)
{
remove_entity(ent)
server_print("ID: %i | Model: %s", ent, Model)
Count++
continue
}
}
}
server_print("Total: %i", Count)
}
This will remove the object and unprecache it IF the map was loaded.
But I want to remove it BEFORE that map was load to bypass the 512 precache limit.
__________________