Xeonmeister

Custom weapon sounds

Recommended Posts

Hi!

I want to replace every single original weapon sound in the game. I've done a little searching and i'd say i almost know how to do it, but i have some questions about the solution.

First: How can i mute the original gun sounds? Is it possible?

Second: If i add an event handler for onClienPlayerWeaponFire and play a sound with playSound3D then will this play the sound for only the local player or for everyone else on the server within the sounds range? It's important cuz i want every player to hear the sound of a sniper shot (within the range of course).

And the last one: How can i adjust the volume of the sound to the player's sound settings? I mean the sound will play, even if the player has his sound volume set to 0, or the sound will be too quiet if the player set his sound volume to maximum.

Share this post


Link to post

Muting the sound I'm not quite sure, I'll have to search the wiki a bit 'Almost positive it is possible'

But as for the rest of what you said playSound3D is played for everyone in range, and as for the volume, you can make it so it pulls the sound volume setting from the player and sets the 3d sounds volume according to that said volume.

Share this post


Link to post

addEventHandler("onClientPlayerWeaponFire", root,

function ( weapon)

if weapon == 34 then

local x,y,z = getElementPosition(localPlayer)

local sound = playSound3D("sounds/sound027.wav", x,y,z)

setSoundMaxDistance(sound,75)

end

end

)

Why doesn't this work? If i shoot with the weapon 34 (sniper) nothing happens. I have the sound027.wav in the sounds folder in the resource's folder. I also added it to meta.xml.

edit: the mta volume was on 0.......

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.