Habe versucht "currentweapon_2" einzufügen damit die secondary waffen auch sounds haben allerdings habe ich jetzt garkeine Sounds mehr. Weiß jemand warum?
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(source,"currentweapon_1")
local weapon = getElementData(source,"currentweapon_2")
if not weapon or weapon2 then return end
weapon = tostring ( weapon )
else
weapon2 = tostring ( weapon2 )
if weapon == "FN FAL" then
sound = playSound3D("sounds/28.wav", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "G36C" then
sound = playSound3D("sounds/20.wav", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "MK48" then
sound = playSound3D("sounds/mk48.wav", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "M249" then
sound = playSound3D("sounds/27.mp3", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "AKM" then
sound = playSound3D("sounds/akm.wav", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "AS50" then
sound = playSound3D("sounds/as50.mp3", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "Winchester Model 70" then
sound = playSound3D("sounds/wini.wav", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "M4A1" then
sound = playSound3D("sounds/17.wav", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "RPK" then
sound = playSound3D("sounds/rpk.wav", muzzleX, muzzleY, muzzleZ, false)
elseif weapon2 == "M1911" then
sound = playSound3D("sounds/Colt45.mp3", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "SPAZ-12 Combat Shotgun" then
sound = playSound3D("sounds/Combat Shotgun.mp3", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "Desert Eagle" then
sound = playSound3D("sounds/Deagle.mp3", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "MP5A5" then
sound = playSound3D("sounds/MP5.mp3", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "Mosin" then
sound = playSound3D("sounds/Rifle.wav", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "Sawn-Off Shotgun" then
sound = playSound3D("sounds/Sawed-Off.mp3", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "Shotgun" then
sound = playSound3D("sounds/Shotgun.mp3", muzzleX, muzzleY, muzzleZ, false)
elseif weapon == "UMP 45" then
sound = playSound3D("sounds/UZI.wav", muzzleX, muzzleY, muzzleZ, false)
end
setSoundMaxDistance(sound, 60)
setSoundMinDistance (sound, 60)
setSoundVolume(sound, 0.5)
end
addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound)
--[[
function shakeCamera()
x,y,z = getPedBonePosition ( getLocalPlayer(), 26 )
if weapon == 22 then
createExplosion ( x,y,z + 10,12,false,0.1,false)
elseif weapon == 24 then
createExplosion ( x,y,z + 10,12,false,0.2,false)
elseif weapon == 25 then
createExplosion ( x,y,z + 10,12,false,0.4,false)
elseif weapon == 26 then
createExplosion ( x,y,z + 10,12,false,0.5,false)
elseif weapon == 27 then
createExplosion ( x,y,z + 10,12,false,0.3,false)
elseif weapon == 28 then
createExplosion ( x,y,z + 10,12,false,0.1,false)
elseif weapon == 29 then
createExplosion ( x,y,z + 10,12,false,0.1,false)
elseif weapon == 30 then
createExplosion ( x,y,z+10,12,false,0.1,false)
elseif weapon == 31 then
createExplosion ( x,y,z + 10,12,false,0.1,false)
elseif weapon == 33 then
createExplosion ( x,y,z + 10,12,false,0.1,false)
elseif weapon == 22 then
createExplosion ( x,y,z + 10,12,false,0.1,false)
elseif weapon == 28 then
createExplosion ( x,y,z + 10,12,false,0.1,false)
elseif weapon == 32 then
createExplosion ( x,y,z + 10,12,false,0.1,false)
elseif weapon == 38 then
createExplosion ( x,y,z + 10,12,false,0.4,false)
end
end
addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), shakeCamera )
--]]
Alles anzeigen