Lua
local function playGunfireSound()
local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source)
local px, py, pz = getElementPosition ( source )
local weapon2 = getElementData(source,"currentweapon_2")
if not weapon2 then return end
weapon2 = tostring ( weapon2 )
if weapon2 == "M1911" then
sound = playSound3D("sounds/Colt45.mp3", muzzleX, muzzleY, muzzleZ, false)
elseif weapon2 == "M9 SD" then
sound = playSound3D("sounds/m9sd.wav", muzzleX, muzzleY, muzzleZ, false)
end
setSoundMaxDistance(sound, 60)
setSoundMinDistance (sound, 60)
setSoundVolume(sound, 0.5)
end
addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound)
Alles anzeigen
Ich möchte für meine currentweapon_2 die gun sounds machen. Allerdings geht das nicht und ich weiß nicht warum. Und noch etwas, immer wenn ich eine primär waffe besitze und eine sekundär waffe und mit der sekundär waffe schieße habe ich den Sounds der Primär Waffe. -.- Ich weiß nicht mehr weiter. Danke für jede Hilfe!