Raised This Month: $12 Target: $400
 3% 

Precache Speed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dav3
Senior Member
Join Date: Apr 2006
Location: Dust2
Old 08-03-2007 , 15:45   Precache Speed
Reply With Quote #1

So, I want to precache files by cvar.
PHP Code:
public plugin_precache() { // precache 
    
new modelname_te[32],modelname_ct[32// getting cvars' string
    
get_cvar_string("amx_adminmodels_model_te",modelname_te,31)
    
get_cvar_string("amx_adminmodels_model_ct",modelname_ct,31)

    new 
locmodelte[128],locmodelct[128// formating it with location
    
format(locmodelte,127,"models/player/%s/%s.mdl",modelname_te,modelname_te)
    
format(locmodelct,127,"models/player/%s/%s.mdl",modelname_ct,modelname_ct)

    
precache_model(locmodelct// precache preformated models
    
precache_model(locmodelte)
    return 
PLUGIN_CONTINUE

I've got only one problem:
HLDS precaches files faster than cvars, its want to precache only models/player//.mdl without the cvar.

Are there any solution 4 it?
Dav3 is offline
Send a message via MSN to Dav3 Send a message via Skype™ to Dav3
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 08-03-2007 , 17:25   Re: Precache Speed
Reply With Quote #2

precache is always executed first,but you can read it from a file before precaching the models,it's the simplest way
danielkza is offline
djmd378
Senior Member
Join Date: Sep 2004
Old 08-03-2007 , 17:41   Re: Precache Speed
Reply With Quote #3

PHP Code:
public plugin_precache() { // precache 

    
register_cvar("amx_adminmodels_model_te","models/tmodel.mdl")
    
register_cvar("amx_adminmodels_model_ct","models/ctmodel.mdl")

    new 
modelname_te[32],modelname_ct[32// getting cvars' string
    
get_cvar_string("amx_adminmodels_model_te",modelname_te,31)
    
get_cvar_string("amx_adminmodels_model_ct",modelname_ct,31)

    new 
locmodelte[128],locmodelct[128// formating it with location
    
format(locmodelte,127,"models/player/%s/%s.mdl",modelname_te,modelname_te)
    
format(locmodelct,127,"models/player/%s/%s.mdl",modelname_ct,modelname_ct)

    
precache_model(locmodelct// precache preformated models
    
precache_model(locmodelte)
    return 
PLUGIN_CONTINUE

With this, it should work...
__________________
djmd378 is offline
Dav3
Senior Member
Join Date: Apr 2006
Location: Dust2
Old 08-04-2007 , 07:35   Re: Precache Speed
Reply With Quote #4

thx, its works
Dav3 is offline
Send a message via MSN to Dav3 Send a message via Skype™ to Dav3
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 14:10.


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