Raised This Month: $51 Target: $400
 12% 

How to play sound on command [CS:GO]


Post New Thread Reply   
 
Thread Tools Display Modes
thecount
Veteran Member
Join Date: Jul 2013
Old 07-31-2015 , 11:00   Re: How to play sound on command [CS:GO]
Reply With Quote #11

On PrecacheSound() and EmitSound() you do not have to put the "sound/" folder in the pathway. It assumes that is already inside there. That is probably your issue.

Last edited by thecount; 07-31-2015 at 11:00.
thecount is offline
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-31-2015 , 11:25   Re: How to play sound on command [CS:GO]
Reply With Quote #12

hmm, interesting, ill check that and return info

Meh, still same
Code
PHP Code:
public OnMapStart()
{
    
AddFileToDownloadsTable("sound/realmod/heal.wav");
    
AddFileToDownloadsTable("sound/realmod/buy.wav");
    
PrecacheSound("realmod/heal.wav");
    
PrecacheSound("realmod/buy.wav");

PHP Code:
       EmitSoundToClient(client"realmod/buy.wav"); 
error
PHP Code:
[SoundS_StartSound(): Failed to load sound 'realmod\buy.wav'File is missing from disk/repository

Last edited by Jcrr; 07-31-2015 at 11:28.
Jcrr is offline
thecount
Veteran Member
Join Date: Jul 2013
Old 07-31-2015 , 11:30   Re: How to play sound on command [CS:GO]
Reply With Quote #13

Hm, well some reason it can't find that file. Are you sure it is downloading when you join?

Last edited by thecount; 07-31-2015 at 11:30.
thecount is offline
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-31-2015 , 11:37   Re: How to play sound on command [CS:GO]
Reply With Quote #14

Yes its downloading, and file exist in:
C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\sound\realmod
It's very strange
Jcrr is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-31-2015 , 14:35   Re: How to play sound on command [CS:GO]
Reply With Quote #15

Some notes:
  1. See CSGO Quirks.
  2. PrecacheSound does nothing on the client side in CS:GO. Either a sound is in the client's precompiled cache or it isn't. This means you can't EmitSound arbitrary sounds either.
  3. The play trick doesn't use positional data and thus you can't emit sounds from specific entities.
  4. The Fake precaching and EmitSound trick only works on MP3s... this is what EmitSoundAny uses.
  5. The music directory trick makes the sounds use the CS:GO music volume slider.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-31-2015 at 14:43.
Powerlord is offline
TheUnderTaker
Senior Member
Join Date: Dec 2013
Location: Israel
Old 07-31-2015 , 14:39   Re: How to play sound on command [CS:GO]
Reply With Quote #16

Quote:
Originally Posted by Jcrr View Post
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
In precache you must remove folder name, in precache you need only file name.
And on emit sound only file name,
__________________
SourcePawn, C# and C++ Programmer.

My plugin list

Last edited by TheUnderTaker; 07-31-2015 at 14:39.
TheUnderTaker is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 07-31-2015 , 15:03   Re: How to play sound on command [CS:GO]
Reply With Quote #17

Do it my way, but you have to convert the sound's sample rate. I forgot how.
blaacky is offline
Jcrr
Senior Member
Join Date: Jul 2015
Old 07-31-2015 , 15:46   Re: How to play sound on command [CS:GO]
Reply With Quote #18

Ok, solved:

Recent reports indicate that this only works for mp3s and not wavs. In the latter case nothing will happen apart from you experiencing puzzled facial expressions and headaches on yourself.

My code now:
PHP Code:
public OnMapStart()
{
    
AddFileToDownloadsTable("sound/realmod/heal.mp3");
    
AddFileToDownloadsTable("sound/realmod/buy.mp3");
    
PrecacheSound("*/realmod/heal.mp3");
    
PrecacheSound("*/realmod/buy.mp3");

Calling for sound
PHP Code:
EmitSoundToClient(client"*/realmod/buy.mp3"); 
Working fine

Last edited by Jcrr; 07-31-2015 at 15:46.
Jcrr is offline
thecount
Veteran Member
Join Date: Jul 2013
Old 07-31-2015 , 22:13   Re: How to play sound on command [CS:GO]
Reply With Quote #19

Oh, I forgot about that CSGO quirk. Why did Valve add this to CSGO? It doesn't really seem to do much beside make us add an asterisk. Maybe it was incase there are sounds outside of the sound folder?
thecount is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 07-31-2015 , 22:25   Re: How to play sound on command [CS:GO]
Reply With Quote #20

you dont need the astris...
headline 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 17:45.


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