Use precache_generic() for sounds that are played client-side (#934)

This commit is contained in:
OciXCrom 2021-09-17 13:10:46 +02:00 committed by GitHub
parent 3289b3c63c
commit 01e60834fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 46 additions and 54 deletions

View File

@ -173,15 +173,7 @@ public plugin_precache( )
} }
if ( file_exists( szSound ) ) if ( file_exists( szSound ) )
{ {
if ( sndExt[1] == 'm') precache_generic( szSound );
{
precache_generic( szSound ); // mp3
}
else
{
replace( szSound, charsmax(szSound), "sound/", "" ); // wav, strip the leading sound/ we added for our file_exists check
precache_sound( szSound );
}
} }
} }
line++; line++;

View File

@ -377,7 +377,7 @@ precache_sound_custom( const sound[] )
formatex(fullpathsound, charsmax(fullpathsound), "sound/%s.wav", sound) formatex(fullpathsound, charsmax(fullpathsound), "sound/%s.wav", sound)
if( file_exists(fullpathsound) ) if( file_exists(fullpathsound) )
{ {
precache_sound(fullpathsound[6]) precache_generic(fullpathsound)
} }
else else
{ {

View File

@ -14,21 +14,21 @@
#include <amxmodx> #include <amxmodx>
public plugin_precache(){ public plugin_precache(){
precache_sound( "misc/impressive.wav") precache_generic( "sound/misc/impressive.wav")
precache_sound( "misc/headshot.wav") precache_generic( "sound/misc/headshot.wav")
precache_sound( "misc/multikill.wav") precache_generic( "sound/misc/multikill.wav")
precache_sound( "misc/doublekill.wav") precache_generic( "sound/misc/doublekill.wav")
precache_sound( "misc/godlike.wav") precache_generic( "sound/misc/godlike.wav")
precache_sound( "misc/ultrakill.wav") precache_generic( "sound/misc/ultrakill.wav")
precache_sound( "misc/killingspree.wav") precache_generic( "sound/misc/killingspree.wav")
precache_sound( "misc/rampage.wav") precache_generic( "sound/misc/rampage.wav")
precache_sound( "misc/unstoppable.wav") precache_generic( "sound/misc/unstoppable.wav")
precache_sound( "misc/monsterkill.wav") precache_generic( "sound/misc/monsterkill.wav")
precache_sound( "misc/humiliation.wav") precache_generic( "sound/misc/humiliation.wav")
precache_sound( "misc/takenlead.wav" ) precache_generic( "sound/misc/takenlead.wav" )
precache_sound( "misc/tiedlead.wav" ) precache_generic( "sound/misc/tiedlead.wav" )
precache_sound( "misc/lostlead.wav" ) precache_generic( "sound/misc/lostlead.wav" )
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }

View File

@ -14,21 +14,21 @@
#include <amxmodx> #include <amxmodx>
public plugin_precache(){ public plugin_precache(){
precache_sound( "misc/impressive.wav") precache_generic( "sound/misc/impressive.wav")
precache_sound( "misc/headshot.wav") precache_generic( "sound/misc/headshot.wav")
precache_sound( "misc/multikill.wav") precache_generic( "sound/misc/multikill.wav")
precache_sound( "misc/doublekill.wav") precache_generic( "sound/misc/doublekill.wav")
precache_sound( "misc/godlike.wav") precache_generic( "sound/misc/godlike.wav")
precache_sound( "misc/ultrakill.wav") precache_generic( "sound/misc/ultrakill.wav")
precache_sound( "misc/killingspree.wav") precache_generic( "sound/misc/killingspree.wav")
precache_sound( "misc/rampage.wav") precache_generic( "sound/misc/rampage.wav")
precache_sound( "misc/unstoppable.wav") precache_generic( "sound/misc/unstoppable.wav")
precache_sound( "misc/monsterkill.wav") precache_generic( "sound/misc/monsterkill.wav")
precache_sound( "misc/humiliation.wav") precache_generic( "sound/misc/humiliation.wav")
precache_sound( "misc/takenlead.wav" ) precache_generic( "sound/misc/takenlead.wav" )
precache_sound( "misc/tiedlead.wav" ) precache_generic( "sound/misc/tiedlead.wav" )
precache_sound( "misc/lostlead.wav" ) precache_generic( "sound/misc/lostlead.wav" )
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }

View File

@ -92,8 +92,8 @@ new g_HeadShots[7][] = {
} }
public plugin_precache(){ public plugin_precache(){
precache_sound( "misc/headshot.wav") precache_generic( "sound/misc/headshot.wav")
precache_sound( "misc/doublekill.wav") precache_generic( "sound/misc/doublekill.wav")
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }

View File

@ -14,21 +14,21 @@
#include <amxmodx> #include <amxmodx>
public plugin_precache(){ public plugin_precache(){
precache_sound( "misc/impressive.wav") precache_generic( "sound/misc/impressive.wav")
precache_sound( "misc/headshot.wav") precache_generic( "sound/misc/headshot.wav")
precache_sound( "misc/multikill.wav") precache_generic( "sound/misc/multikill.wav")
precache_sound( "misc/doublekill.wav") precache_generic( "sound/misc/doublekill.wav")
precache_sound( "misc/godlike.wav") precache_generic( "sound/misc/godlike.wav")
precache_sound( "misc/ultrakill.wav") precache_generic( "sound/misc/ultrakill.wav")
precache_sound( "misc/killingspree.wav") precache_generic( "sound/misc/killingspree.wav")
precache_sound( "misc/rampage.wav") precache_generic( "sound/misc/rampage.wav")
precache_sound( "misc/unstoppable.wav") precache_generic( "sound/misc/unstoppable.wav")
precache_sound( "misc/monsterkill.wav") precache_generic( "sound/misc/monsterkill.wav")
precache_sound( "misc/humiliation.wav") precache_generic( "sound/misc/humiliation.wav")
precache_sound( "misc/takenlead.wav" ) precache_generic( "sound/misc/takenlead.wav" )
precache_sound( "misc/tiedlead.wav" ) precache_generic( "sound/misc/tiedlead.wav" )
precache_sound( "misc/lostlead.wav" ) precache_generic( "sound/misc/lostlead.wav" )
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }