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

As far as i know you can use : onClientPlayerWeaponFire Add onClientRender Then getCameraMatrix After that : setCameraMatrix With + 0.5 Or something like that i hope you understand it and after that you have to spawn the player on the player position with getElementPosition And

getElementModel Then setCmaeraTraget After All That spawnPlayer You must use TriggerServerEvent Or setElementPosition At the client sided .

  

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 ) 

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

Freeroam resource is scripted in a different way .

If you aren't expert in scripting, I don't recommend modifying it .

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

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...