Quote:
Originally Posted by h3bus
So, precaching after mapstart works perfectly. I'd messed up elswhere.
Thanks all!
|
I know this is an old post... but how did you get it to work?
I am trying to do the same thing in CS:GO by adding a path name to the string table after the game has started using
PHP Code:
AddToStringTable( FindStringTable( "soundprecache" ), szPath );
I have it setup so that when a client connects, I re-add the file to the string table before using EmitSoundToClient...
When I go to play the sound, I check to see if the string is in the table, if it is I use Emit Sound... but then EmitSound tells me the file wasnt there:
Here is the code from the function that produced that output:
PHP Code:
PrintToServer("------- File contains .mp3 ------ play star ------ %s ", SoundPaths[soundGroupId][randomSoundId]);
// Below, workaround for playing CUSTOM sounds in CSGO
decl String:relativeSoundPath[PLATFORM_MAX_PATH];
Format(relativeSoundPath, sizeof(relativeSoundPath), "*/%s", SoundPaths[soundGroupId][randomSoundId]);
/////
if ((FindStringIndex( FindStringTable( "soundprecache" ), relativeSoundPath)) != INVALID_STRING_INDEX)
{
/////
PrintToServer("------- relative path FOUND in String Table ----------- ");
PrintToServer("------- using Emit Sound to play ---------- ----------- ");
EmitSoundToClient(client, relativeSoundPath);
}
else
{
PrintToServer("--NOT-- relative path NOT found in str Table ---------- ");
PrintToServer("------- using CLIENT command to play ------ ----------- ");
decl String:playrelativeSoundPath[PLATFORM_MAX_PATH];
Format(playrelativeSoundPath, sizeof(playrelativeSoundPath), "play */%s", SoundPaths[soundGroupId][randomSoundId]);
ClientCommand( client, playrelativeSoundPath );
}