Raised This Month: $32 Target: $400
 8% 

How to play sound on command [CS:GO]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-30-2015 , 12:56   How to play sound on command [CS:GO]
Reply With Quote #1

Hello, i want that on that command:
PHP Code:
    RegConsoleCmd("TEST_COMMAND"TEST_FUNC);

public 
Action:TEST_FUNC(clientargs)
{
        
//here i want to have PICKUP SOUND

Like in code, when player will write TEST_COMMAND, he will hear PICKUP SOUND from CS:GO (ofc. on CSGO server)

Thanks in advance
Jcrr is offline
Darkness_
Veteran Member
Join Date: Nov 2014
Old 07-30-2015 , 13:06   Re: How to play sound on command [CS:GO]
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=237045
Darkness_ is offline
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-30-2015 , 13:15   Re: How to play sound on command [CS:GO]
Reply With Quote #3

Ok, thank you very much

But i have problem with it.
Sound is downloaded succesfully, but it wont play ingame, and console (client side ingame) return this when try to play sound
PHP Code:
[SoundS_StartSound(): Failed to load sound '*sound\buy.wav'File is missing from disk/repository
but the sound is there :/
I tried mp3 files and console return this:
PHP Code:
[SoundS_StartSound(): Failed to load sound '*sound\realmod\heal.mp3'Can't create mixer. 

Last edited by Jcrr; 07-30-2015 at 16:28.
Jcrr is offline
Austinbots
Member
Join Date: Jan 2010
Old 07-31-2015 , 01:44   Re: How to play sound on command [CS:GO]
Reply With Quote #4

I don't know what the pick up sound is but
EmitSoundToAll()
works every time for me.

Quote:
Originally Posted by Jcrr View Post
Hello, i want that on that command:
PHP Code:
    RegConsoleCmd("TEST_COMMAND"TEST_FUNC);

public 
Action:TEST_FUNC(clientargs)
{
        
//here i want to have PICKUP SOUND
       
EmitSoundToAll("buttons/blip1.wav");

Like in code, when player will write TEST_COMMAND, he will hear PICKUP SOUND from CS:GO (ofc. on CSGO server)

Thanks in advance

Last edited by Austinbots; 07-31-2015 at 01:45.
Austinbots is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 07-31-2015 , 02:22   Re: How to play sound on command [CS:GO]
Reply With Quote #5

Assuming you know how to precache it and add it to the downloads table, I had the same problem you do and after researching I found you can play sounds this way:

PHP Code:
ClientCommand(client"play */realmod/heal.mp3"); 
blaacky is offline
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-31-2015 , 05:44   Re: How to play sound on command [CS:GO]
Reply With Quote #6

Used this cmd:
PHP Code:
ClientCommand(client"play */realmod/heal.mp3"); 
Tried .wav, error:
PHP Code:
S_StartSoundFailed to load sound '*sound\buy.wav'File is missing from disk/repository
Tried all standard mp3 formats, error:
PHP Code:
S_StartSoundInvalid sample rate (48000) for sound '*\realmod\buy.mp3'
WTF sourcemod :/

Last edited by Jcrr; 07-31-2015 at 05:44.
Jcrr is offline
TheUnderTaker
Senior Member
Join Date: Dec 2013
Location: Israel
Old 07-31-2015 , 06:32   Re: How to play sound on command [CS:GO]
Reply With Quote #7

If it custom sound,so add the first line, if no so no.
PHP Code:
AddFileToDownloadsTable("place/sound.mp3"); 
And
PHP Code:
 PrecacheSound("sound.mp3"); 
And then where you want
PHP Code:
EmitSoundToAll("sound.mp3); 
__________________
SourcePawn, C# and C++ Programmer.

My plugin list

Last edited by TheUnderTaker; 07-31-2015 at 06:33.
TheUnderTaker is offline
hadesownage
AlliedModders Donor
Join Date: Jun 2013
Location: Romania, Iași
Old 07-31-2015 , 06:46   Re: How to play sound on command [CS:GO]
Reply With Quote #8

https://forums.alliedmods.net/showthread.php?t=237045
hadesownage is offline
Send a message via Yahoo to hadesownage Send a message via Skype™ to hadesownage
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-31-2015 , 07:23   Re: How to play sound on command [CS:GO]
Reply With Quote #9

Quote:
Originally Posted by TheUnderTaker View Post
If it custom sound,so add the first line, if no so no.
PHP Code:
AddFileToDownloadsTable("place/sound.mp3"); 
And
PHP Code:
 PrecacheSound("sound.mp3"); 
And then where you want
PHP Code:
EmitSoundToAll("sound.mp3); 
I arledy got this:
PHP Code:
public OnMapStart()
{
    
AddFileToDownloadsTable("sound/realmod/heal.wav");
    
AddFileToDownloadsTable("sound/realmod/buy.wav");
    
PrecacheSound("sound/realmod/heal.wav");
    
PrecacheSound("sound/realmod/buy.wav");

Sound callout:
PHP Code:
EmitSoundToClient(client"sound/realmod/buy.wav");  
EmitSoundToClient(client"sound/realmod/heal.wav"); 
And it gives me that error:
PHP Code:
[SoundS_StartSound(): Failed to load sound 'sound\realmod\heal.wav'File is missing from disk/repository.
[
SoundS_StartSound(): Failed to load sound 'sound\realmod\buy.wav'File is missing from disk/repository
Files are succesful downloaded from server, and they are present in dir:
C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\sound\realmod

Last edited by Jcrr; 07-31-2015 at 07:24.
Jcrr is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 07-31-2015 , 10:50   Re: How to play sound on command [CS:GO]
Reply With Quote #10

What is disk/repository anyway?

Last edited by Potato Uno; 07-31-2015 at 10:50.
Potato Uno 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 15:06.


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