AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Precaching everything that's in a file (https://forums.alliedmods.net/showthread.php?t=144001)

Backstabnoob 11-27-2010 16:45

Precaching everything that's in a file
 
Sorry for posting a stupid thread once again, however I'm not familiar in this kind of things.

I need someone to show me how to precache every MODEL (yeah, the file will only contain models so it's easier) in the specified file.

ex:

Files.ini:
Code:

models/model1.mdl
models/player/playerx/playerx.mdl
...

and all the files will get precached. Nothing more, nothing less.

Thanks in advance.

drekes 11-27-2010 17:05

Re: Precaching everything that's in a file
 
in plugin_precache() read the file and precache the model,
then go to the next line ...

fysiks 11-27-2010 17:11

Re: Precaching everything that's in a file
 
A plugin that uses a specific model should precache the model already (if it's designed correctly). There should be no need for something like this, ever.

Backstabnoob 11-27-2010 17:29

Re: Precaching everything that's in a file
 
Believe me, this is a need for me.

To drakas: Well that tells me exactly what I've written in the thread. I need a code example, was trying to look through some plugins also but found some trie crap that doesn't really need to be used here.

hleV 11-27-2010 17:36

Re: Precaching everything that's in a file
 
Not tested.
Code:
new const File[] = "precache.ini";   public plugin_precache() {         new file = fopen(File, "r");           if (!file)                 return;           new resource[64], extension[5];           while (fgets(file, resource, 63))         {                 trim(resource);                 copy(extension, 4, resource[strlen(resource) - 4]);                   if (equal(extension, ".wav"))                         precache_sound(resource);                 else if (equal(extension, ".mdl") || equal(extension, ".spr"))                         precache_model(resource);                 else                         precache_generic(resource);         }           fclose(file); }

YamiKaitou 11-27-2010 17:47

Re: Precaching everything that's in a file
 
Look at these plugins, there are probably more if you search as well.
http://forums.alliedmods.net/showthread.php?p=596438
http://forums.alliedmods.net/showthread.php?p=583443

fysiks 11-27-2010 17:47

Re: Precaching everything that's in a file
 
Quote:

Originally Posted by Backstabnoob (Post 1358258)
Believe me, this is a need for me.

To drakas: Well that tells me exactly what I've written in the thread. I need a code example, was trying to look through some plugins also but found some trie crap that doesn't really need to be used here.

Nope, not going to believe you. Who is Drakas?

Tell me what model you would need precached that never gets used by the engine, map, or plugin?

Backstabnoob 11-27-2010 17:57

Re: Precaching everything that's in a file
 
Players can buy skins or hats etc. for some virtual money on the website (for week, two weeks etc.)

However, the skins won't get precached if I retrieve the skin paths from the database (they are stored there with the delay, price and things like that), cuz the SQL select is somehow delayed (it takes about 2 seconds until it initializes, connects, ...) and thus I need to make another file where I will store the file paths so they can get properly precached.

Thanks hleV, I'll try it.


All times are GMT -4. The time now is 11:23.

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