Jump to content

Ayuda con sónido para 1 ID


DropDead41

Recommended Posts

function disableSounds()  
setAmbientSoundEnabled( "gunfire", true )  
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 == "AS50" then  
                 -- outputChatBox ( weapon )  
                  local sound = playSound3D("soundweapons/as50.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40)  
              elseif weapon == "DMR" 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 == "M107" then  
                  local sound = playSound3D("soundweapons/m107.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 == "Mosin 9130" then  
                  local sound = playSound3D("soundweapons/mosin.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "SVD DRAGUNOV CAMO" then  
                  local sound = playSound3D("soundweapons/svd.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "KVSK" then  
                  local sound = playSound3D("soundweapons/as50.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
                   
              elseif weapon == "MK 48 Mod 0" then  
                  local sound = playSound3D("soundweapons/mk48.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "MG36" then  
                  local sound = playSound3D("soundweapons/mg36.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "PKP" then  
                  local sound = playSound3D("soundweapons/pkp.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "AK-107" then  
                  local sound = playSound3D("soundweapons/ak107.mp3", 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 == "SA-58V ACOG" then  
                  local sound = playSound3D("soundweapons/sa58v.mp3", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "M4A1 Holo" then  
                  local sound = playSound3D("soundweapons/m4a1.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
                   
              elseif weapon == "SKS-45" then  
                  local sound = playSound3D("soundweapons/sks45.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
                   
              elseif weapon == "Makarov PM" then  
                  local sound = playSound3D("soundweapons/makarovpm.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "G18" then  
                  local sound = playSound3D("soundweapons/g18.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "Revolver" then  
                  local sound = playSound3D("soundweapons/revolver.wav", muzzleX, muzzleY, muzzleZ, false)  
                  setSoundMaxDistance(sound, 40) 
              elseif weapon == "USP.45 SD" 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) 

Este script funciona perfecto, pero quiero saber como llamo a que identifique la id de un objeto.. nose si me explico.. va un ejemplo:

if weapon == "AS50" and objeto == 1870 then

-- outputChatBox ( weapon )

local sound = playSound3D("soundweapons/as50.wav", muzzleX, muzzleY, muzzleZ, false)

setSoundMaxDistance(sound, 40)

(objeto) es la id de un objeto del server al que le asigno un arma.. espero que me hallan entendido.. gracias de antemano por la ayuda ;)

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...