AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Emit sound (https://forums.alliedmods.net/showthread.php?t=215590)

cstrike37 05-09-2013 18:39

Emit sound
 
Hi, sometimes sound wont play when another sound is being played. My question is: Is it possible to play multiple sound at the same time using emit or force it to play?

PHP Code:

public DeathMsg()
{
    new 
Victim read_data(2); //get the second message parameter

    
new origin[3];
    
pev(Victimpev_originorigin);
    
    new 
entity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
    
engfunc(EngFunc_SetOriginentityorigin);
    
set_pev(entitypev_classname"emitter");
    
    
emit_sound(entityCHAN_VOICE"misc/affn.wav"VOL_NORMATTN_NORM0PITCH_NORM);
    
    
set_task(5.0"kill_entity"entity+1337);


And

PHP Code:

public func_sounds(idchannel, const sound[], Float:volumeFloat:attnflagspitch)
{
    if(
equal(sound[7],"bhit",4))
    {
        
engfunc(EngFunc_EmitSound,id,channel,pain[random_num(0sizeof pain 1)],volume,attn,flags,pitch)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED



Blizzard_87 05-10-2013 04:55

Re: Emit sound
 
try different channels

cstrike37 05-10-2013 12:58

Re: Emit sound
 
Okay thanks.
But what's the difference between these channels?

PHP Code:

Sound Constants:
//Sound Channels
#define CHAN_AUTO     0
#define CHAN_WEAPON     1
#define CHAN_VOICE     2
#define CHAN_ITEM     3
#define CHAN_BODY     4
#define CHAN_STREAM     5
#define CHAN_STATIC     6
#define CHAN_NETWORKVOICE_BASE    7
#define CHAN_NETWORKVOICE_END    500 


Blizzard_87 05-10-2013 17:42

Re: Emit sound
 
try the auto one. Or you could just use
client_ cmd( 0, "spk soundhere" );

then if sound long just do client_cmd( 0, "stopsound" ); when you want to stop all sounds

cstrike37 05-10-2013 18:54

Re: Emit sound
 
I'll try thanks!
And is it possible to change the sound radius using client_cmd?

Blizzard_87 05-10-2013 19:03

Re: Emit sound
 
Quote:

Originally Posted by cstrike37 (Post 1949600)
I'll try thanks!
And is it possible to change the sound radius using client_cmd?

no you can only set sound radius in emit_sound so for sounds you dont need to have a limit on radius just use client_cmd( 0, "spk.......

cstrike37 05-10-2013 19:49

Re: Emit sound
 
Quote:

Originally Posted by Blizzard_87 (Post 1949602)
no you can only set sound radius in emit_sound so for sounds you dont need to have a limit on radius just use client_cmd( 0, "spk.......

Oh
What if I use Ham_Killed? or is it the same as Deathmsg?

Blizzard_87 05-10-2013 20:40

Re: Emit sound
 
test both. see which works?

cstrike37 05-10-2013 20:45

Re: Emit sound
 
I just used DeathMsg cause it works better :)

I have another question, how do I make this play 4 random sound instead of just 1?
PHP Code:

engfunc(EngFunc_EmitSoundidchannel"test/test1.wav"1.0attenuationflagspitch); 

I tried doing this

PHP Code:

engfunc(EngFunc_EmitSoundidchanneldie_spk[random_num(0sizeof die_spk 1)], 1.00.92flagspitch); 

But it's not working, it's only playing 1 sound

Blizzard_87 05-10-2013 20:50

Re: Emit sound
 
its spose to only play one. It plays one by random.


All times are GMT -4. The time now is 10:58.

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