Raised This Month: $51 Target: $400
 12% 

How to successfully precache files


Post New Thread Reply   
 
Thread Tools Display Modes
platzpatrone
Veteran Member
Join Date: Apr 2007
Location: Germany
Old 08-29-2010 , 20:57   Re: How to successfully precache files
Reply With Quote #21

Quote:
Originally Posted by Arkshine View Post
Anyway, see the connor's plugins, he uses the right method.
just to mention: without any SVC_BAD ! and the API is really helpful
for own Plugins
platzpatrone is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 08-29-2010 , 22:46   Re: How to successfully precache files
Reply With Quote #22

If you're making a variable to precache it, why not use that variable when you client_cmd() or cs_set_user_model()?

Like:
Code:
client_cmd( iIndex, "spk %s", g_szSound );

Or:
Code:
cs_set_user_model( iIndex, g_szModel );
__________________
Hi.

Last edited by Kreation; 08-29-2010 at 23:06.
Kreation is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-29-2010 , 22:51   Re: How to successfully precache files
Reply With Quote #23

Quote:
Originally Posted by Kreation View Post
Or:
Code:
cs_set_user_model( iIndex, g_szModel );
Fixed
__________________
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
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 08-29-2010 , 23:06   Re: How to successfully precache files
Reply With Quote #24

Quote:
Originally Posted by YamiKaitou View Post
Fixed
Yeah, I knew that looked wrong.
__________________
Hi.
Kreation is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-29-2010 , 23:13   Re: How to successfully precache files
Reply With Quote #25

Quote:
Originally Posted by Kreation View Post
If you're making a variable to precache it, why not use that variable when you client_cmd() or cs_set_user_model()?

Like:
Code:
client_cmd( iIndex, "spk %s", g_szSound );

Or:
Code:
cs_set_user_model( iIndex, "%s", g_szModel );
You can't always do that when using cs_set_user_model(). If the variable g_szModel = "models/player/modelname/modelname.mdl" then it won't work because it can only be used with "modelname".

HOWEVER, this is 100% dependent on how you define g_szModel and how you use it in precache_model().

Basically, you can't do precache_model(g_szModel) AND cs_set_user_model(id, g_szModel) if g_szModel remains unchange between these two functions.
__________________
fysiks is offline
r14170
Veteran Member
Join Date: Dec 2009
Old 09-02-2010 , 15:46   Re: How to successfully precache files
Reply With Quote #26

thx for the TUT!
r14170 is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 09-03-2010 , 01:48   Re: How to successfully precache files
Reply With Quote #27

For player models, don't use precache_model() as they don't need to be loaded into the engine. Use precache_generic().
Infact, you use precache_generic() for ANYTHING that doesn't need to be loaded (IE: Setting a model onto a created entity / emitting a sound - Needs to be loaded precache_sound/model())

If you just want a player to download a given file (like a player model, that they can be set too) precache_generic() should be used.
Same goes for sounds, if you use your method the "spk" command. You're loading the sound into the engine using "precache_sound()" you don't want that. There's no need.

Bad practice everywhere!
__________________
Oh yeah

Last edited by Drak; 09-03-2010 at 01:54.
Drak is offline
Send a message via MSN to Drak
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-03-2010 , 02:32   Re: How to successfully precache files
Reply With Quote #28

Quote:
Originally Posted by Drak View Post
For player models, don't use precache_model() as they don't need to be loaded into the engine. Use precache_generic().
Infact, you use precache_generic() for ANYTHING that doesn't need to be loaded (IE: Setting a model onto a created entity / emitting a sound - Needs to be loaded precache_sound/model())

If you just want a player to download a given file (like a player model, that they can be set too) precache_generic() should be used.
Same goes for sounds, if you use your method the "spk" command. You're loading the sound into the engine using "precache_sound()" you don't want that. There's no need.

Bad practice everywhere!
What do you mean by "loaded into the engine"?
__________________
fysiks is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-06-2010 , 06:19   Re: How to successfully precache files
Reply With Quote #29

I would like to hear the answer too.
__________________
Arkshine is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 09-06-2010 , 09:32   Re: How to successfully precache files
Reply With Quote #30

Quote:
Originally Posted by fysiks View Post
What do you mean by "loaded into the engine"?
I think that when you precache a sound with precache_sound the sound is loaded into a list, that does not allow more than 255 sounds. These sounds are the ones that are truly needed for running the server, and are used in emit_sound, emit_ambientsound, pm_playsound. Generic loads files in a separate list a second one that can support other files and more as number, and these sounds aren't used in emit_sound, just in spk or others.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
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 15:07.


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