Raised This Month: $ Target: $400
 0% 

Precaching everything that's in a file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 11-27-2010 , 16:45   Precaching everything that's in a file
Reply With Quote #1

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.
Backstabnoob is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-27-2010 , 17:05   Re: Precaching everything that's in a file
Reply With Quote #2

in plugin_precache() read the file and precache the model,
then go to the next line ...
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-27-2010 , 17:11   Re: Precaching everything that's in a file
Reply With Quote #3

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.
__________________
fysiks is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 11-27-2010 , 17:29   Re: Precaching everything that's in a file
Reply With Quote #4

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.
Backstabnoob is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-27-2010 , 17:47   Re: Precaching everything that's in a file
Reply With Quote #5

Quote:
Originally Posted by Backstabnoob View Post
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?
__________________
fysiks is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 11-27-2010 , 17:36   Re: Precaching everything that's in a file
Reply With Quote #6

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); }
__________________
hleV is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-27-2010 , 17:47   Re: Precaching everything that's in a file
Reply With Quote #7

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
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 11-27-2010 , 17:57   Re: Precaching everything that's in a file
Reply With Quote #8

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.
Backstabnoob is offline
Old 11-27-2010, 18:15
fysiks
This message has been deleted by fysiks. Reason: Nevermind, I'm done with this.
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 11:23.


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