AlliedModders

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

Evaldas.Grigas 10-27-2011 08:13

Play sound.
 
What is command to play sound?

Xellath 10-27-2011 08:19

Re: Play sound.
 
Depending on your need:

emit_sound() to play a sound at a specific origin (all players can hear this).

client_cmd() to play a sound for a specific player (using either spk or mp3play).

Evaldas.Grigas 10-27-2011 08:20

Re: Play sound.
 
emit_sound(). Thank you. I'll test it.
EDIT: I don't understand. Can you give me an example?

Xellath 10-27-2011 08:34

Re: Play sound.
 
Funcwiki explains it very well.

Example:

Code:
// syntax // player index, channel, sound, volume, attenuation value, flags, pitch value emit_sound( index, channel, sample[ ], Float:vol, Float:att, flags, pitch ); // to a player with index "id" emit_sound( id, CHAN_STATIC, "your sound here", 0.35, ATTN_NORM, 0, PITCH_NORM ); // to everyone emit_sound( 0, CHAN_STATIC, "your sound here", 0.35, ATTN_NORM, 0, PITCH_NORM );

Code:
/* Constants for emit_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  /* allocate stream channel from the static or dynamic area */ #define CHAN_STATIC  6  /* allocate channel from the static area */ #define CHAN_NETWORKVOICE_BASE  7   /* voice data coming across the network */ #define CHAN_NETWORKVOICE_END   500 /* network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). */ /* Attenuation values */ #define ATTN_NONE    0.00 #define ATTN_NORM    0.80 #define ATTN_IDLE    2.00 #define ATTN_STATIC  1.25 /* Pitch values */ #define PITCH_NORM   100    /* non-pitch shifted */ #define PITCH_LOW    95 /* other values are possible - 0-255, where 255 is very high */ #define PITCH_HIGH   120 /* Volume values */ #define VOL_NORM     1.0

Evaldas.Grigas 10-27-2011 08:37

Re: Play sound.
 
Do I have define everything?
For example I will use this: Is it right?
emit_sound( 0, CHAN_STATIC, "admin_join", 0.35, ATTN_NORM, 0, PITCH_NORM );

Xellath 10-27-2011 08:45

Re: Play sound.
 
Try it.

Everything is defined already, no need to redefine it.

Evaldas.Grigas 10-27-2011 08:51

Re: Play sound.
 
Where should be sound? /cstrike/sound?


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

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