AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   precache files (https://forums.alliedmods.net/showthread.php?t=104947)

LordKowen 09-29-2009 12:53

precache files
 
First of all, excuse my bad english :oops:

I need a method for 'precache' files from my server.

i.e:

When any player join in my server, automatically download generic files (like models, sounds...) in the directory I specify.

I only found a solution in the .res files (in cstrike/maps folder). This method works fine, but I need to make a .res file for each map (i.e: map1.res, map2.res...). It's so hard when I need to add or delete a file.

My question is... exists any generic method for all de_, cs_, etc. maps? (like prefix_de.res or de_prefix.res)... I already tried that with this examples, but does not work.

Or better, is possible to do a .res for all maps types??

Also, I tried to use "prefix_de.cfg" (for all de_ maps) in addons/amxmod/configs/maps folder, but this is only for commands (like cvars).

If exist any method for do this (using .cfg / .ini), I prefer this solution, because this files are always needed, map type does not matter.

If it's possible, I want to do this without plugins.


Please, help me! need backup!

Thanks!

Arkshine 09-29-2009 13:08

Re: precache files
 
All maps are not the same and dont have the same resources. It's normal to have one res by map. I don't understand your problem.

LordKowen 09-30-2009 03:19

Re: precache files
 
Quote:

Originally Posted by Arkshine (Post 946913)
All maps are not the same and dont have the same resources. It's normal to have one res by map. I don't understand your problem.

Yeah, I know, and I have a unique .res for each map, because as you say, each map needs their resources. (models, wad, sprites, etc.)

My problem is... I have models with 2 files, the first is the model and the other is the texture. i.e: zombie.mdl, zombieT.mdl.

But in my mod, I only can call to one model in the "mod.ini" config, but I need download the "texture model" file, in the same directory, for view that model.

I try to import textures (with Jedi model viewer), but does not work.

My solution: write the line "models/player/zombieT" in all .res files.

If you know another solution, please tell me.

Thanks for answering. Thank you very much. ;)

P.S: Sorry for my english, I promise to study more. :P

Arkshine 09-30-2009 03:33

Re: precache files
 
Your problem is related to your plugin, so you have to modify your plugin. What I would do is when you get the model name while reading the file, I would check if the same model name with T exists, if so I precache it.

LordKowen 09-30-2009 04:59

Re: precache files
 
Thank you Arkshine, I will try that.

I dont know how to do that, but I will investigate.

+ karma 4 you !!! :)

Arkshine 09-30-2009 05:38

Re: precache files
 
Not that hard. After you get the model name, format the name adding "T" ( format[ex](), add() ), check if the file exists ( file_exists() ; remember you need the full path ), if so, precache it. ( precache_sound() for wav, precache_generic() for mp3 )

LordKowen 09-30-2009 06:43

Re: precache files
 
I found this plugin that solves this problem.

http://forums.alliedmods.net/showthr...light=precache

"This plugin precaches the texture models (*t.mdl) of any models precached by the server"

Look a part of code:
Code:

        // Determine the associated *t.mdl file and check if it exists
        strcat(sz, "t.mdl", 127);
        // Calling engfunc completes precache right away, whereas a
        // call to precache_model is, more or less, added to a queue.
        if(file_exists(sz)) engfunc(EngFunc_PrecacheModel, sz);
        regex_free(hReg);

But I want to use plugins, so try your method first.

Thanks again :wink:


All times are GMT -4. The time now is 22:32.

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