Jump to content

Help with new weapons!


Tycka

Recommended Posts

  
addEventHandler('onClientPlayerWeaponFire', getLocalPlayer(), 
 function(id) 
local x, y, z = getPedWeaponMuzzlePosition(source) 
if id == 22 then 
      local sound = playSound3D('colt45', x, y, z) 
setSoundMaxDistance(sound, 50) 
end 
end) 
  

Didn't work

Link to comment
Didi you have the sound

yes, I have. Here how I use it.

addEventHandler('onClientPlayerWeaponFire', getLocalPlayer(), 
 function(1) 
local x, y, z = getPedWeaponMuzzlePosition(source) 
if id == 34 then 
      local sound = playSound3D('sounds/as50.waw', x, y, z) 
setSoundMaxDistance(sound, 50) 
end 
end 

And I have 3 sniper in 34Id, but with other object.

Link to comment
Well its function(id) and not function(1)

addEventHandler('onClientPlayerWeaponFire', getLocalPlayer(), 
 function(id) 
local x, y, z = getPedWeaponMuzzlePosition(source) 
if id == 34 then 
      local sound = playSound3D('sounds/as50.waw', x, y, z) 
setSoundMaxDistance(sound, 50) 
end 
end 

Still now working.

That work but I can't use different sounds on 3 differents snipers.

function disableSounds() 
setAmbientSoundEnabled( "gunfire", false ) 
end 
addEventHandler("onClientResourceStart",root,disableSounds) 
  
local function playGunfireSound(weaponID) 
    local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source) 
    local px, py, pz = getElementPosition ( source ) 
    elseif weaponID == 34 then 
            local sound = playSound3D("sounds/as50.waw", muzzleX, muzzleY, muzzleZ, false) 
            setSoundMaxDistance(sound, 40) 
    end 
end 
addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound) 
  

Link to comment

How can you expect it to work lol!

  
  
function disableSounds() 
    setAmbientSoundEnabled( "gunfire", false ) 
end 
addEventHandler("onClientResourceStart",root,disableSounds) 
  
local function playGunfireSound() 
    local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source) 
    local px, py, pz = getElementPosition ( source ) 
    local weaponID = getElementModel(source) 
    if weaponID == 34 then 
        local sound = playSound3D("sounds/as50.waw", muzzleX, muzzleY, muzzleZ, false) 
        setSoundMaxDistance(sound, 40) 
    end 
end 
addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound) 
  

Lol all can't check wiki

Link to comment

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