Jump to content

How do i change my weapon sounds?


Recommended Posts

Posted

hi everyone,i learned how to mod cars,weapons,skins before a few days ago from you guys.do anyone know to change weapon sfx sound? if so please reply.thank you.

Posted (edited)

For example :

addEventHandler("onClientPlayerWeaponFire", getRootElement(),  
function ( weapon, ammo, ammoInClip ) 
                local x,y,z = getElementPosition(source) 
                if weapon == 30 then  
                local sound = playSound3D("AK.mp3", x,y,z) 
                setSoundMaxDistance(sound,75) 
        end 
    end 
) 
  

Meta :

    
Edited by Guest
Posted

Instead of using setCameraMatrix I'd suggest to create fake explosion underneath the player.

https://wiki.multitheftauto.com/wiki/CreateExplosion

bool createExplosion ( float x, float y, float z, int theType [, bool makeSound = true, float camShake = -1.0, bool damaging = true ] ) 

When calling this function pass false as makeSound argument and damaging as false. This way player will not get damaged by the explosion and there won't be any sound but camera will shake.

Posted

5p where to put this line?

addEventHandler("onClientPlayerWeaponFire", getRootElement(), 
function ( weapon, ammo, ammoInClip ) 
                local x,y,z = getElementPosition(source) 
                if weapon == 22 then 
                local sound = playSound3D("hg.mp3", x,y,z) 
                setSoundVolume(sound,10) 
                setSoundMaxDistance(sound,75) 
        end 
    end 
) 

Posted
addEventHandler ( 'onClientPlayerWeaponFire', root, function ( weapon, ammo, ammoInClip ) 
    local x,y,z = getElementPosition ( source ) 
    if weapon == 22 then 
        local sound = playSound3D ( 'hg.mp3', x, y, z ) 
        setSoundVolume ( sound, 10 ) 
        setSoundMaxDistance ( sound, 75 ) 
        createExplosion ( x, y, z - 0.2, 2, false, true, false ) 
    end 
end ) 

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.
×
×
  • Create New...