Raised This Month: $ Target: $400
 0% 

precache files


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LordKowen
Member
Join Date: Sep 2009
Location: Spain
Old 09-29-2009 , 12:53   precache files
Reply With Quote #1

First of all, excuse my bad english

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!
LordKowen is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-29-2009 , 13:08   Re: precache files
Reply With Quote #2

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.
__________________
Arkshine is offline
LordKowen
Member
Join Date: Sep 2009
Location: Spain
Old 09-30-2009 , 03:19   Re: precache files
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
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.

Last edited by LordKowen; 09-30-2009 at 03:28.
LordKowen is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-30-2009 , 03:33   Re: precache files
Reply With Quote #4

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.
__________________
Arkshine is offline
LordKowen
Member
Join Date: Sep 2009
Location: Spain
Old 09-30-2009 , 04:59   Re: precache files
Reply With Quote #5

Thank you Arkshine, I will try that.

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

+ karma 4 you !!!
LordKowen is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-30-2009 , 05:38   Re: precache files
Reply With Quote #6

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 )
__________________
Arkshine is offline
LordKowen
Member
Join Date: Sep 2009
Location: Spain
Old 09-30-2009 , 06:43   Re: precache files
Reply With Quote #7

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
LordKowen is offline
Reply


Thread Tools
Display Modes

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 22:32.


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