Raised This Month: $ Target: $400
 0% 

[Meta plugin] How to precache models?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bos93
Veteran Member
Join Date: Jul 2010
Old 11-26-2012 , 08:09   [Meta plugin] How to precache models?
Reply With Quote #1

PHP Code:
char g_szAlienModel[] = "models/zp/alien.mdl";

void OnPluginsLoaded( )
{
    
PRECACHE_MODEL(g_szAlienModel);

doesn't work,but amxx module worked.
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-26-2012 , 08:34   Re: [Meta plugin] How to precache models?
Reply With Quote #2

You say it doesn't work, you have no error ? Nothing happens ?

If nothing happens, are you sure OnPluginsLoaded is called ?
If an error, it should be because you have to call it in precache time, like in Spawn() (what does AMXX with plugin_precache() )
__________________

Last edited by Arkshine; 11-26-2012 at 08:36.
Arkshine is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 11-26-2012 , 08:36   Re: [Meta plugin] How to precache models?
Reply With Quote #3

no error,i am create entity,and error: models not precached

models not precache for client..
__________________

Last edited by Bos93; 11-26-2012 at 08:39.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-26-2012 , 08:47   Re: [Meta plugin] How to precache models?
Reply With Quote #4

Quote:
If nothing happens, are you sure OnPluginsLoaded is called ?
__________________
Arkshine is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 11-26-2012 , 08:56   Re: [Meta plugin] How to precache models?
Reply With Quote #5

added messages in OnPluginsLoaded , is not called
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 11-26-2012 , 09:20   Re: [Meta plugin] How to precache models?
Reply With Quote #6

PHP Code:
bool g_Precached false;

int DispatchSpawnedict_t * ) {
  if( !
g_Precached ) {
    
PRECACHE_MODEL"models/corn.mdl" );

    
g_Precached true;
  }

  
RETURN_META_VALUEMRES_IGNORED);
}

void ServerDeactivatevoid ) {
  
g_Precached false;

  
RETURN_METAMRES_IGNORED );

__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Bos93
Veteran Member
Join Date: Jul 2010
Old 11-26-2012 , 10:41   Re: [Meta plugin] How to precache models?
Reply With Quote #7

Hattrick,thanks, it works!
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Bos93
Veteran Member
Join Date: Jul 2010
Old 11-30-2012 , 06:32   Re: [Meta plugin] How to precache models?
Reply With Quote #8

Why this code is crashing the server?

PHP Code:
charg_aszSound[] = 
{
    
"zb4/boss_dash.wav",
    
"zb4/boss_death.wav",
    
"zb4/boss_footstep_1.wav",
    
"zb4/boss_footstep_2.wav",
    
"zb4/boss_shokwave.wav",
    
"zb4/boss_swing.wav",
    
"zb4/boss_voice_1.wav"
}; 
PHP Code:
        int iFile;
    
        for( 
iFile iFile sizeof g_aszSoundiFile++ )
        {
            
PRECACHE_SOUNDg_aszSoundiFile ] );
        } 
PHP Code:
int DispatchSpawnedict_t *pEntity )
{
    if( !
g_Precached 
    {
        
PRECACHE_MODELg_szAlienModel );

        
int iFile;
    
        for( 
iFile iFile sizeof g_aszSoundiFile++ )
        {
            
PRECACHE_SOUNDg_aszSoundiFile ] );
        }

        
g_sModelIndexBloodSpray PRECACHE_MODEL ("sprites/bloodspray.spr"); 
        
g_sModelIndexBloodDrop PRECACHE_MODEL ("sprites/blood.spr"); 
        
g_sModelIndexExplode PRECACHE_MODEL ("sprites/shockwave.spr"); 

        
g_Precached true;

        
ZBS_SHOCWAVE = ( 10.0 );
    }

    if (
g_bInitialized)
        
RETURN_META_VALUE(MRES_IGNORED0);

    
g_bActivated false;
    
g_bInitialized true;

    
RETURN_META_VALUE(MRES_IGNORED0);





but,


PHP Code:
PRECACHE_SOUND"zb4/boss_dash.wav" );
        
PRECACHE_SOUND"zb4/boss_death.wav" );
        
PRECACHE_SOUND"zb4/boss_footstep_1.wav" );
        
PRECACHE_SOUND"zb4/boss_footstep_2.wav" );
        
PRECACHE_SOUND"zb4/boss_shokwave.wav" );
        
PRECACHE_SOUND"zb4/boss_swing.wav" );
        
PRECACHE_SOUND"zb4/boss_voice_1.wav" ); 
it's worked.
__________________

Last edited by Bos93; 11-30-2012 at 06:39.
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 11-30-2012 , 06:45   Re: [Meta plugin] How to precache models?
Reply With Quote #9

sizeof ( g_aszSound ) = 7 * sizeof( char * ) = 28.

You should learn C++ before to try to develop modules.
__________________
micapat is offline
Bos93
Veteran Member
Join Date: Jul 2010
Old 11-30-2012 , 06:47   Re: [Meta plugin] How to precache models?
Reply With Quote #10

solved

ARRAYSIZE(g_aszSound)

thanks to quckly
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
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 07:09.


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