AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Changing the sound of weapons (https://forums.alliedmods.net/showthread.php?t=171139)

andre neves 11-02-2011 10:23

Changing the sound of weapons
 
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?

kiki33hun 11-02-2011 10:33

Re: Changing the sound of weapons
 
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;
}

???:D

Arkshine 11-02-2011 11:50

Re: Changing the sound of weapons
 
No.

kiki33hun 11-02-2011 14:08

Re: Changing the sound of weapons
 
Edit your mp.dll! Image :
http://kepfeltoltes.hu/111102/adsads...toltes.hu_.png

Arkshine 11-02-2011 14:36

Re: Changing the sound of weapons
 
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.

.Dare Devil. 11-02-2011 14:43

Re: Changing the sound of weapons
 
Quote:

Originally Posted by kiki33hun (Post 1588519)

Can you upload this program or give download link :) ?

kiki33hun 11-02-2011 14:43

Re: Changing the sound of weapons
 
One code: https://forums.alliedmods.net/showthread.php?t=95132

Use m249 and replace all sound!

Sry bad english!

kiki33hun 11-02-2011 14:44

Re: Changing the sound of weapons
 
Quote:

Originally Posted by .Dare Devil. (Post 1588535)
Can you upload this program or give download link :) ?



http://www.hex-rays.com/products/ida...download.shtml

.Dare Devil. 11-02-2011 15:48

Re: Changing the sound of weapons
 
Quote:

Originally Posted by kiki33hun (Post 1588538)

Thanks

Quote:

Originally Posted by Arkshine (Post 1588532)
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.

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.

Arkshine 11-02-2011 17:01

Re: Changing the sound of weapons
 
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.


All times are GMT -4. The time now is 14:23.

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