Raised This Month: $51 Target: $400
 12% 

Changing the sound of weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
andre neves
Junior Member
Join Date: Mar 2011
Old 11-02-2011 , 10:23   Changing the sound of weapons
Reply With Quote #1

I tried to do this with FM_EmitSound, but it seems that it only works with knife sounds.

Anyone know a better way to change the sounds?
andre neves is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 11-02-2011 , 10:33   Re: Changing the sound of weapons
Reply With Quote #2

Code:
#include <amxmodx>
#include <fakemeta>

#define NEWSOUND "mysoundhere.wav" //<-- Ide írd be az uj hangot!

public plugin_init() {
    register_forward(FM_EmitSound,"fw_emitsound");
}

public plugin_precache() {
    precache_sound(NEWSOUND);
}


public fw_emitsoundound(entity,channel,sample[],Float:volume,Float:attenuation,fFlags,pitch) {

    if(equali(sample,"weapons/awp1.wav")) {
        emit_sound(entity,channel,NEWSOUND,volume,attenuation,fFlags,pitch);
        return FMRES_SUPERCEDE;
    }

    return FMRES_IGNORED;
}
???
__________________
kiki33hun is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-02-2011 , 11:50   Re: Changing the sound of weapons
Reply With Quote #3

No.
__________________
Arkshine is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 11-02-2011 , 14:08   Re: Changing the sound of weapons
Reply With Quote #4

Edit your mp.dll! Image :
__________________
kiki33hun is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-02-2011 , 14:36   Re: Changing the sound of weapons
Reply With Quote #5

You miss the point the fire sounds are played client-side (because of prediction), therefore you can't hook them.
And for your information, what you show is a reference to CAK47::Precache() and only that.
Instead of wasting your time to make a screenshot, you should have tested your plugin or/and checked IDA more.
__________________

Last edited by Arkshine; 11-02-2011 at 14:42.
Arkshine is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 11-02-2011 , 14:43   Re: Changing the sound of weapons
Reply With Quote #6

Quote:
Originally Posted by kiki33hun View Post
Edit your mp.dll! Image :
Can you upload this program or give download link ?
.Dare Devil. is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 11-02-2011 , 14:43   Re: Changing the sound of weapons
Reply With Quote #7

One code: https://forums.alliedmods.net/showthread.php?t=95132

Use m249 and replace all sound!

Sry bad english!
__________________
kiki33hun is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 11-02-2011 , 14:44   Re: Changing the sound of weapons
Reply With Quote #8

Quote:
Originally Posted by .Dare Devil. View Post
Can you upload this program or give download link ?


http://www.hex-rays.com/products/ida...download.shtml
__________________
kiki33hun is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 11-02-2011 , 15:48   Re: Changing the sound of weapons
Reply With Quote #9

Quote:
Originally Posted by kiki33hun View Post
Thanks

Quote:
Originally Posted by Arkshine View Post
You miss the point the fire sounds are played client-side (because of prediction), therefore you can't hook them.
And for your information, what you show is a reference to CAK47:recache() and only that.
Instead of wasting your time to make a screenshot, you should have tested your plugin or/and checked IDA more.
I have thinking here,

Weapons sounds cant be a client side and can change and hook them.
When sounds are in client side then ohters players can not hear that player weapon sounds who shoot.

When player shoot
game send the message to server
( sound id, weapon ) - something like this

Then server send to player that message.


In amxmodx and mayby a metamod has not been done that hook weapon sounds.


I have 85% sure we can hook them like ohters things.
And the footstep sound too.
I'm not a programmer so i can not do miracles.


But yeah, mayby cs was done that way: ( this is 15% sure case )

When player are in server then ohter players are connected with that player and player game dont send the message to server, only players.
.Dare Devil. is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-02-2011 , 17:01   Re: Changing the sound of weapons
Reply With Quote #10

Weapon sounds are played on the client, meaning the code which plays the sound exists only in the binary on the client's computer, using the client API, something like :
Code:
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/pl_gun3.wav", gEngfuncs.pfnRandomFloat(0.92, 1.0), ATTN_NORM, 0, 98 + gEngfuncs.pfnRandomLong( 0, 3 ) )
I don't know exactly how work the netcode, but it's most likely propagated directly on the others clients.
__________________
Arkshine 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 09:26.


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