This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Help playing default game sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gdk
Member
Join Date: Oct 2014
Old 10-29-2015 , 10:26   Help playing default game sound
Reply With Quote #1

I'm looking to play a games (cs:go) default sound (one that is packed into the pak01_dir.pk) In order to not require a user to download a sound file.

I want to play a radio command for example lets say I want to play gign.disagree10

In "csgo/scripts/game_sounds_gign.txt":

Code:
"gign.disagree10"
{
		"channel"		"CHAN_VOICE"
		"volume"	"1"
		"soundlevel" "0"
		"wave"		"player\vo\gign\disagree10.wav"
}
My question is can i do this with EmitGameSoundToClient? Do i have to precache the sound? I'm not sure what const char[] gameSound to pass to it.

I tried the following, but no sound is played

Code:
public OnPluginStart()
{
	RegConsoleCmd("sm_test", Command_Test);
}
public OnMapStart() 
{ 
	PrecacheScriptSound("gign.disagree10");
} 
public Action:Command_Test(client, args)
{
	EmitGameSoundToClient(client, "gign.disagree10");
	return Plugin_Handled;
}
Any help or ideas would make my day
Gdk is offline
decowboy
AlliedModders Donor
Join Date: Oct 2015
Location: Guadalajara, Mexico
Old 10-29-2015 , 15:59   Re: Help playing default game sound
Reply With Quote #2

The below link offers some sample code. Try using the actual path to the file ("player\vo\gign\disagree10.wav") instead of "gign.disagree10".

https://wiki.alliedmods.net/Csgo_qui..._Custom_Sounds

Last edited by decowboy; 10-29-2015 at 16:03.
decowboy is offline
Gdk
Member
Join Date: Oct 2014
Old 10-29-2015 , 16:43   Re: Help playing default game sound
Reply With Quote #3

Still having trouble with it. I might try it out in a different game if its just csgo related. Not really that important for me. Appreciate the help.
Gdk is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-30-2015 , 12:03   Re: Help playing default game sound
Reply With Quote #4

Hmmm...

Can you load this plugin then run the /emittest while on the server and tell me what it says?

(Side note: It logs these messages to the SourceMod log in addition to sending it to the player in chat.)
Attached Files
File Type: sp Get Plugin or Get Source (emitgamesoundtest.sp - 696 views - 3.3 KB)
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Gdk
Member
Join Date: Oct 2014
Old 10-30-2015 , 12:54   Re: Help playing default game sound
Reply With Quote #5

Code:
emittest
Playing sound: "gign.disagree10" ("common/null.wav").

[emitgamesoundtest.smx] Playing sound: "gign.disagree10" ("common/null.wav") to "Gdk<2><STEAM_x:x:xxx><>".
So it is playing common/null.wav instead. Btw null.wav is in the pak01_dir.vpk "sound/common/null.wav"

The acutal sound file DOES get played, it is just that null.wav is a really soft and short sound.
Gdk is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 10-30-2015 , 13:19   Re: Help playing default game sound
Reply With Quote #6

Can't you just play "player\vo\gign\disagree10.wav" instead?
Miu is offline
Gdk
Member
Join Date: Oct 2014
Old 10-30-2015 , 13:36   Re: Help playing default game sound
Reply With Quote #7

Quote:
Originally Posted by Miu View Post
Can't you just play "player\vo\gign\disagree10.wav" instead?
I think no because emitgamesound asks for the NAME of the sound, not the PATH TO the sound.

Code:
Syntax:
stock bool:EmitGameSoundToClient(client, 
                const String:gameSound[], 
                entity = SOUND_FROM_PLAYER, 
                flags = SND_NOFLAGS, 
                speakerentity = -1, 
                const Float:origin[3] = NULL_VECTOR, 
                const Float:dir[3] = NULL_VECTOR, 
                bool:updatePos = true, 
                Float:soundtime = 0.0)

Usage:
 client               Client index.
 gameSound            Name of game sound.
 entity               Entity to emit from.
 flags                        Sound flags.
 speakerentity        Unknown.
 origin               Sound origin.
 dir                  Sound direction.
 updatePos            Unknown (updates positions?)
 soundtime            Alternate time to play sound for.
Gdk is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 10-30-2015 , 13:58   Re: Help playing default game sound
Reply With Quote #8

Right! As in, thought it might work with EmitSoundToClient instead, but I wouldn't know
Miu is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-30-2015 , 14:00   Re: Help playing default game sound
Reply With Quote #9

Quote:
Originally Posted by Gdk View Post
Code:
emittest
Playing sound: "gign.disagree10" ("common/null.wav").

[emitgamesoundtest.smx] Playing sound: "gign.disagree10" ("common/null.wav") to "Gdk<2><STEAM_x:x:xxx><>".
So it is playing common/null.wav instead. Btw null.wav is in the pak01_dir.vpk "sound/common/null.wav"

The acutal sound file DOES get played, it is just that null.wav is a really soft and short sound.
That's weird.

This is in the game_sounds_manifest.txt:
Code:
         "precache_file"        "scripts/game_sounds_gign.txt"
Meaning that sounds in scripts/game_sounds_gign.txt should be loaded and precached.

While I know this function currently works in TF2, the internal code for this function is slightly different between games made prior to Portal 2 (such as TF2) than games made after Portal 2 (such as CS:GO?).

I may have to poke the SourceMod team and see if they've heard anything about changes to CS:GO that would break this.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 10-30-2015 , 16:48   Re: Help playing default game sound
Reply With Quote #10

For client sounds to play in CS:GO without downloading, I did it this way, work just fine.
PHP Code:
ClientCommand(client"playgamesound Music.StopAllMusic");
ClientCommand(client"play error.wav");
ClientCommand(client"play training/countdown.wav"); 
Maxximou5 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 14:29.


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