Raised This Month: $ Target: $400
 0% 

About EngFunc_PrecacheSound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 04-16-2011 , 12:26   About EngFunc_PrecacheSound
Reply With Quote #1

EngFunc_PrecacheSound

This function is very useful for me because of the cvars I have for the sounds. Well do I still need to use this in plugin_precache then?

http://forums.alliedmods.net/showpos...1&postcount=15
bibu is offline
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 04-16-2011 , 12:35   Re: About EngFunc_PrecacheSound
Reply With Quote #2

Quote:
Originally Posted by bibu View Post
Well do I still need to use this in plugin_precache then?
sure
__________________

Working on:
nothing
schmurgel1983 is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-16-2011 , 12:44   Re: About EngFunc_PrecacheSound
Reply With Quote #3

Still wonder how this works.
Cause the cvars are in plugin_init. Precache is in plugin_precache. And that will be called first.
bibu is offline
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 04-16-2011 , 12:50   Re: About EngFunc_PrecacheSound
Reply With Quote #4

1. plugin_native()
2. plugin_precache()
3. plugin_init()
4. plugin_cfg()
__________________

Working on:
nothing
schmurgel1983 is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-16-2011 , 12:53   Re: About EngFunc_PrecacheSound
Reply With Quote #5

So how does it exactly work then with EngFunc_PrecacheSound?
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-16-2011 , 12:58   Re: About EngFunc_PrecacheSound
Reply With Quote #6

Whatever EngFunc_PrecacheSound or precache_sound, both call the engine call pfnPrecacheSound.

Difference is precache_sound has to be used in plugin_precache() forward. Such natives are forced to be used into this forward. Forward called at the very spawn of the server.

plugin_init/cfg is called when server is activated, much more later after the precache, but it doesn't mean you can't precache there. At this time, you sill can precache things, server just being activated.

Since, EngFunc_PrecacheSound is not forced to be used in plugin_precache(), that's why you can use it in either plugin_init or plugin_cfg.
__________________
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-16-2011 , 13:01   Re: About EngFunc_PrecacheSound
Reply With Quote #7

Wow, thanks for this.

Last edited by bibu; 04-16-2011 at 13:06.
bibu is offline
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 04-16-2011 , 13:01   Re: About EngFunc_PrecacheSound
Reply With Quote #8

Quote:
Originally Posted by Arkshine View Post
Since, EngFunc_PrecacheSound is not forced to be used in plugin_precache(), that's why you can use it in either plugin_init or plugin_cfg.
oh O.o
__________________

Working on:
nothing
schmurgel1983 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-16-2011 , 13:06   Re: About EngFunc_PrecacheSound
Reply With Quote #9

EngFunc_* constants are wrappers to engine calls. There is no real control/check on them before being executing.
__________________
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-16-2011 , 13:07   Re: About EngFunc_PrecacheSound
Reply With Quote #10

Can I make something like this?

PHP Code:
public plugin_init()
{
// my pcvars here
    
set_task(1.0my_precache)
}
public 
my_precache()
{
    
//get_pcvar -> precache the sound

bibu 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 20:13.


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