Raised This Month: $ Target: $400
 0% 

Solved Remove Entity and Unprecache before map load


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-11-2020 , 11:50   Remove Entity and Unprecache before map load
Reply With Quote #1

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(PLUGINVERSIONAUTHOR)
    
Remove_Ent()
}

public 
plugin_precache( ) 
{
    
register_forwardFM_PrecacheModel"fw_PrecacheModel" )    
}

public 
fw_PrecacheModel( const Model[ ] ) 

    new 
Contain
    
for( new 0sizeofRemove_Obj ); i++ ) 
    { 
        
Contain containi(ModelRemove_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 
CountContain
    
for(new ent 1ent MAXENTSent++) 
    {
        for( new 
0sizeofRemove_Obj ); i++ ) 
        { 
            if (!
is_valid_ent(ent))
                continue
            
            
pev(entpev_modelModelcharsmax(Model))
            
Contain contain(ModelRemove_Obj[i])
            if(
Contain != -1
            {
                
remove_entity(ent)
                
server_print("ID: %i | Model: %s"entModel)
                
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.
__________________
My plugin:

Last edited by Celena Luna; 06-11-2020 at 14:57.
Celena Luna is offline
 



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 17:12.


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