Jump to content

Bug nos sons das armas novas


Recommended Posts

eu tenho armas novas add no meu server e os sons estão bugados, eles funcionam normalmente mais se eu atiro exemplo com a m16a2 e meu amigo esteja com g36c e ele atirar com a g36c eu ouço o som da m16a2 na g36c e para ele a mesma coisa só que com o som da g36c

codigo do sistema

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 weapon = getElementData(localPlayer,"currentweapon_1")         
           if not weapon then return end         
        weapon = tostring ( weapon )  
              if weapon == " " then  
                 -- outputChatBox ( weapon )  
                  local sound = playSound3D("soundweapons/as50.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40)  
             elseif weapon == "M16A2" then  
                  local sound = playSound3D("soundweapons/m16a2.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 130) 
             elseif weapon == "FN FAL" then  
                  local sound = playSound3D("soundweapons/fal.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == " " then  
                  local sound = playSound3D("soundweapons/dmr.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40)   
              elseif weapon == "M24 (Desert)" then  
                  local sound = playSound3D("soundweapons/m24.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "AK-107" then  
                  local sound = playSound3D("soundweapons/ak107.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "CZ550" then  
                  local sound = playSound3D("soundweapons/cz550.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == " " then  
                  local sound = playSound3D("soundweapons/mosin.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "SVD Camo" then  
                  local sound = playSound3D("soundweapons/svd.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == " " then  
                  local sound = playSound3D("soundweapons/as50.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
                   
              elseif weapon == "M240" then  
                  local sound = playSound3D("soundweapons/mk48.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "G36C" then  
                  local sound = playSound3D("soundweapons/mg36.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "RPK" then  
                  local sound = playSound3D("soundweapons/pkp.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "AKS-74u" then  
                  local sound = playSound3D("soundweapons/aks74u.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "AKS (GOLD)" then  
                  local sound = playSound3D("soundweapons/aksgold.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "Saiga 12k" then  
                  local sound = playSound3D("soundweapons/sa58v.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "M4A1 CCO SD" then  
                  local sound = playSound3D("soundweapons/m4a1.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 10) 
                   
              elseif weapon == "M14 AIM" then  
                  local sound = playSound3D("soundweapons/sks45.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
                   
              elseif weapon == " " then  
                  local sound = playSound3D("soundweapons/makarovpm.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == " " then  
                  local sound = playSound3D("soundweapons/g18.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == " " then  
                  local sound = playSound3D("soundweapons/revolver.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == " " then  
                  local sound = playSound3D("soundweapons/usp45.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "Winchester 1866" then  
                  local sound = playSound3D("soundweapons/winchester.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40)    
                   
              end 
             end 
addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound) 

Link to comment

Como esse problema ocorre apenas com as novas armas, então pode ser um problema na integração delas, ou no som delas.

A menos que seja os sons invertidos na pasta.

Use outputDebugString para tentar encontrar erros na execução.

E no servidor, digite o comando debugscript 3.

Exemplo:

Na linha 47, você pode fazer o seguinte:

elseif weapon == "G36C" then 
outputDebugString("Arma: G36C") 
local sound = playSound3D("soundweapons/mg36.mp3", muzzleX, muzzleY, muzzleZ, false) 
setSoundMaxDistance(sound, 40) 
... 
  

Também, veja como funciona com as armas antigas, e faça da mesma forma.

Além disso, o evento "onClientResourceStart" deve ter resourceRoot em vez de root no segundo argumento.

Link to comment

então amigo fis tudo que você falou mais não funcionou '-

function disableSounds()  
setAmbientSoundEnabled( "gunfire", false )  
end  
addEventHandler("onClientResourceStart",resourceRoot,disableSounds)  
  
local function playGunfireSound()  
           local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source)  
           local px, py, pz = getElementPosition ( source )  
           local weapon = getElementData(localPlayer,"currentweapon_1")         
           if not weapon then return end         
        weapon = tostring ( weapon )  
                    
             if weapon == "M16A2" then 
                  outputDebugString("Arma: M16A2") 
                  local sound = playSound3D("soundweapons/m16a2.mp3", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 130) 
                   
                  elseif weapon == "FN FAL" then 
                  outputDebugString("Arma: FN FAL") 
                  local sound = playSound3D("soundweapons/fal.mp3", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 110) 
                   
                  elseif weapon == "M24 (Desert)" then 
                  outputDebugString("Arma: M24 (Desert)") 
                  local sound = playSound3D("soundweapons/m24.wav", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 120) 
                   
                  elseif weapon == "AK-107" then 
                  outputDebugString("Arma: AK-107") 
                  local sound = playSound3D("soundweapons/ak107.wav", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 125) 
                   
                  elseif weapon == "CZ550" then 
                  outputDebugString("Arma: CZ550") 
                  local sound = playSound3D("soundweapons/cz550.mp3", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 135)                   
                   
                  elseif weapon == "SVD Camo" then 
                  outputDebugString("Arma: SVD Camo") 
                  local sound = playSound3D("soundweapons/svd.mp3", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 100) 
                   
                  elseif weapon == "M240" then 
                  outputDebugString("Arma: M240") 
                  local sound = playSound3D("soundweapons/mk48.wav", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 140) 
                   
                  elseif weapon == "G36C" then 
                  outputDebugString("Arma: G36C") 
                  local sound = playSound3D("soundweapons/mg36.mp3", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 130) 
                   
                  elseif weapon == "RPK" then 
                  outputDebugString("Arma: RPK") 
                  local sound = playSound3D("soundweapons/pkp.wav", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 125) 
                   
                  elseif weapon == "AKS-74u" then 
                  outputDebugString("Arma: AKS-74u") 
                  local sound = playSound3D("soundweapons/aks74u.mp3", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 115) 
                   
                  elseif weapon == "Saiga 12k" then 
                  outputDebugString("Arma: Saiga 12k") 
                  local sound = playSound3D("soundweapons/sa58v.mp3", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 100) 
                 
                  elseif weapon == "AKS (GOLD)" then 
                  outputDebugString("Arma: AKS (GOLD)") 
                  local sound = playSound3D("soundweapons/aksgold.mp3", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 110) 
                   
                  elseif weapon == "M4A1 CCO SD" then 
                  outputDebugString("Arma: M4A1 CCO SD") 
                  local sound = playSound3D("soundweapons/m4a1.wav", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 20) 
                   
                  elseif weapon == "M14 AIM" then 
                  outputDebugString("Arma: M14 AIM") 
                  local sound = playSound3D("soundweapons/sks45.wav", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 125) 
                 
                  elseif weapon == "Winchester 1866" then 
                  outputDebugString("Arma: Winchester 1866") 
                  local sound = playSound3D("soundweapons/sks45.wav", muzzleX, muzzleY, muzzleZ, false) 
                  setSoundMaxDistance(sound, 120) 
                   
              end 
             end 
addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound) 

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