AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Precache Speed (https://forums.alliedmods.net/showthread.php?t=58855)

Dav3 08-03-2007 15:45

Precache Speed
 
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?

danielkza 08-03-2007 17:25

Re: Precache Speed
 
precache is always executed first,but you can read it from a file before precaching the models,it's the simplest way

djmd378 08-03-2007 17:41

Re: Precache Speed
 
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...

Dav3 08-04-2007 07:35

Re: Precache Speed
 
thx, its works


All times are GMT -4. The time now is 10:57.

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