AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   About EngFunc_PrecacheSound (https://forums.alliedmods.net/showthread.php?t=155014)

bibu 04-16-2011 12:26

About EngFunc_PrecacheSound
 
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

schmurgel1983 04-16-2011 12:35

Re: About EngFunc_PrecacheSound
 
Quote:

Originally Posted by bibu (Post 1451445)
Well do I still need to use this in plugin_precache then?

sure

bibu 04-16-2011 12:44

Re: About EngFunc_PrecacheSound
 
Still wonder how this works. :)
Cause the cvars are in plugin_init. Precache is in plugin_precache. And that will be called first.

schmurgel1983 04-16-2011 12:50

Re: About EngFunc_PrecacheSound
 
1. plugin_native()
2. plugin_precache()
3. plugin_init()
4. plugin_cfg()

bibu 04-16-2011 12:53

Re: About EngFunc_PrecacheSound
 
So how does it exactly work then with EngFunc_PrecacheSound?

Arkshine 04-16-2011 12:58

Re: About EngFunc_PrecacheSound
 
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.

bibu 04-16-2011 13:01

Re: About EngFunc_PrecacheSound
 
Wow, thanks for this. :up:

schmurgel1983 04-16-2011 13:01

Re: About EngFunc_PrecacheSound
 
Quote:

Originally Posted by Arkshine (Post 1451468)
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

Arkshine 04-16-2011 13:06

Re: About EngFunc_PrecacheSound
 
EngFunc_* constants are wrappers to engine calls. There is no real control/check on them before being executing.

bibu 04-16-2011 13:07

Re: About EngFunc_PrecacheSound
 
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




All times are GMT -4. The time now is 20:13.

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