Raised This Month: $ Target: $400
 0% 

[CS:GO] Is it possible to "Precache" sound after OnMapStart?


Post New Thread Reply   
 
Thread Tools Display Modes
Gotank65
Junior Member
Join Date: Jun 2006
Location: Bucks
Old 08-11-2016 , 20:22   Re: [CS:GO] Is it possible to "Precache" sound after OnMapStart?
Reply With Quote #11

Quote:
Originally Posted by h3bus View Post
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:
AddToStringTableFindStringTable"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(relativeSoundPathsizeof(relativeSoundPath), "*/%s"SoundPaths[soundGroupId][randomSoundId]);
            
/////
            
if ((FindStringIndexFindStringTable"soundprecache" ), relativeSoundPath)) != INVALID_STRING_INDEX)
            {
                
/////
                
PrintToServer("------- relative path FOUND in String Table ----------- ");
                
PrintToServer("------- using Emit Sound to play ---------- ----------- ");
                
EmitSoundToClient(clientrelativeSoundPath);
            }
            else
            {
                
PrintToServer("--NOT-- relative path NOT found in str Table ---------- ");
                
PrintToServer("------- using CLIENT command to play ------ ----------- ");
                
decl String:playrelativeSoundPath[PLATFORM_MAX_PATH];
                
Format(playrelativeSoundPathsizeof(playrelativeSoundPath), "play */%s"SoundPaths[soundGroupId][randomSoundId]);
                
ClientCommandclientplayrelativeSoundPath );
            } 
Gotank65 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 05:21.


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