Raised This Month: $ Target: $400
 0% 

Problem with replacing knife sound (emit_sound)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pro Patria Finland
Senior Member
Join Date: Apr 2006
Location: BaronPub.com
Old 06-01-2007 , 16:17   Problem with replacing knife sound (emit_sound)
Reply With Quote #1

So, anyhows, long story short:

I replace sounds as suggested in this thread: http://forums.alliedmods.net/showthread.php?t=23303&

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fakemeta> new CBARHIT_SOUND[] = "sounds/cbar_hit1.wav" new CBARHIT_SOUND2[]    = "sounds/cbar_hit2.wav" new CBARBOD_SOUND[] = "sounds/cbar_hitbod1.wav" new CBARBOD_SOUND2[]    = "sounds/cbar_hitbod2.wav" new CBARBOD_SOUND3[]    = "sounds/cbar_hitbod3.wav" new CBARMISS_SOUND[]    = "sounds/cbar_miss1.wav" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_forward(FM_EmitSound,"fw_emitsound"); } public plugin_precache() {     precache_sound(CBARHIT_SOUND)     precache_sound(CBARHIT_SOUND2)     precache_sound(CBARBOD_SOUND)     precache_sound(CBARBOD_SOUND2)     precache_sound(CBARBOD_SOUND3)     precache_sound(CBARMISS_SOUND) } public fw_emitsound(entity,channel,sample[],Float:volume,Float:attenuation,fFlags,pitch) {         if(equal(sample,"weapons/knife_slash1.wav")) {             emit_sound(entity,channel,CBARMISS_SOUND,volume,attenuation,fFlags,pitch);     return FMRES_SUPERCEDE;     }     if(equal(sample,"weapons/knife_slash2.wav")) {      emit_sound(entity,channel,CBARMISS_SOUND,volume,attenuation,fFlags,pitch);     return FMRES_SUPERCEDE;     }         if(equal(sample,"weapons/knife_hitwall1.wav")) {      emit_sound(entity,channel,CBARHIT_SOUND,volume,attenuation,fFlags,pitch);     return FMRES_SUPERCEDE;     }         if(equal(sample,"weapons/knife_hit1.wav")) {      emit_sound(entity,channel,CBARBOD_SOUND,volume,attenuation,fFlags,pitch);     return FMRES_SUPERCEDE;     }             if(equal(sample,"weapons/knife_hit2.wav")) {     emit_sound(entity,channel,CBARBOD_SOUND2,volume,attenuation,fFlags,pitch);     return FMRES_SUPERCEDE;     }             if(equal(sample,"weapons/knife_hit3.wav")) {     emit_sound(entity,channel,CBARBOD_SOUND3,volume,attenuation,fFlags,pitch);     return FMRES_SUPERCEDE;     }         if(equal(sample,"weapons/knife_hit4.wav")) {     emit_sound(entity,channel,CBARBOD_SOUND3,volume,attenuation,fFlags,pitch);     return FMRES_SUPERCEDE;     }             return FMRES_IGNORED;   }
The plugin compiles. Then I add it to my AMXX plugins and start a game. The game does start, so it means that there should be no error in precaching the sounds. Still in game I have succesfully disabled the original knife sound, but I can't hear the new sound at all.

Okay, I am quite new to this whole scripting, and I am very new to Fakemeta. So laugh your heads off or whatever, but what am I doing wrong? Any suggestions to this problem?
__________________
I am not a number. I am Gordon Freeman!
Pro Patria Finland is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 06-01-2007 , 16:49   Re: Problem with replacing knife sound (emit_sound)
Reply With Quote #2

Assuming the rest of your code is right, I think you might have to change from this:

Code:
new CBARHIT_SOUND[] = "sounds/cbar_hit1.wav"
to

Code:
new CBARHIT_SOUND[] = "cbar_hit1.wav"
stupok is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 06-01-2007 , 16:50   Re: Problem with replacing knife sound (emit_sound)
Reply With Quote #3

i think you should place the sounds in an extra folder for example "sounds\cbar"
and then replace "sounds/" with "cbar/"
Quote:
new CBARHIT_SOUND[] = "sounds/cbar_hit1.wav"
new CBARHIT_SOUND2[] = "sounds/cbar_hit2.wav"
new CBARBOD_SOUND[] = "sounds/cbar_hitbod1.wav"
new CBARBOD_SOUND2[] = "sounds/cbar_hitbod2.wav"
new CBARBOD_SOUND3[] = "sounds/cbar_hitbod3.wav"
new CBARMISS_SOUND[] = "sounds/cbar_miss1.wav"
that should work...the "sounds/" folder should be the problem..

greetz regalis

*edit* lol first sawce beat me now stupok69...today is not my day *edit*
__________________
regalis is offline
Pro Patria Finland
Senior Member
Join Date: Apr 2006
Location: BaronPub.com
Old 06-01-2007 , 17:32   Re: Problem with replacing knife sound (emit_sound)
Reply With Quote #4

Okay, I will go for it (edit will follow).

Edit:

THAAANKSS!!
Not only the code was wrong, I also noticed that the sounds were in the wrong folder.
The folder where you keep the sounds should be called "sound" instead of "sounds."

Problem solved, cookies on the way!
__________________
I am not a number. I am Gordon Freeman!

Last edited by Pro Patria Finland; 06-01-2007 at 17:46.
Pro Patria Finland is offline
Reply


Thread Tools
Display Modes

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 10:34.


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