Raised This Month: $ Target: $400
 0% 

Play sound.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-27-2011 , 08:13   Play sound.
Reply With Quote #1

What is command to play sound?
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-27-2011 , 08:19   Re: Play sound.
Reply With Quote #2

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).
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-27-2011 , 08:20   Re: Play sound.
Reply With Quote #3

emit_sound(). Thank you. I'll test it.
EDIT: I don't understand. Can you give me an example?
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067

Last edited by Evaldas.Grigas; 10-27-2011 at 08:23.
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-27-2011 , 08:34   Re: Play sound.
Reply With Quote #4

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
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-27-2011 , 08:37   Re: Play sound.
Reply With Quote #5

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 );
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067

Last edited by Evaldas.Grigas; 10-27-2011 at 08:39.
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-27-2011 , 08:45   Re: Play sound.
Reply With Quote #6

Try it.

Everything is defined already, no need to redefine it.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-27-2011 , 08:51   Re: Play sound.
Reply With Quote #7

Where should be sound? /cstrike/sound?
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
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 14:20.


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