Jump to content

Help with sounds


BocTpuk

Recommended Posts

Posted
setWorldSoundEnabled(19, false)
setWorldSoundEnabled(24, false)

addEventHandler("onPlayerWeaponFire", root, function()
  local weapon = getPedWeapon(source)
  if weapon == 24 then
    playSound("sounds/m4fire.wav", false)
  elseif weapon == 24 then
    playSound("sounds/deaglefire.wav", false)
  end
end)

just an example for deagle and m4 sounds you can add the weapons you do like to replace 
 

Posted
1 hour ago, FLUSHBICEPS said:
setWorldSoundEnabled(19, false)
setWorldSoundEnabled(24, false)

addEventHandler("onPlayerWeaponFire", root, function()
  local weapon = getPedWeapon(source)
  if weapon == 24 then
    playSound("sounds/m4fire.wav", false)
  elseif weapon == 24 then
    playSound("sounds/deaglefire.wav", false)
  end
end)

just an example for deagle and m4 sounds you can add the weapons you do like to replace 
 

onPlayerWeaponFire is a server event 

use 

Posted
1 hour ago, alex17" said:

onPlayerWeaponFire is a server event 

use 

my fault I’ve made that quick asf xd

function onResourceStart()
  setWorldSoundEnabled(19, false)
  setWorldSoundEnabled(24, false)

  addEventHandler("onClientPlayerWeaponFire", localPlayer, function()
    local weapon = getPedWeapon(localPlayer)
    if weapon == 24 then
      playSound("sounds/m4fire.wav", false)
    elseif weapon == 24 then
      playSound("sounds/deaglefire.wav", false)
    end
  end)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

 

Posted
On 06/02/2023 at 13:22, BocTpuk said:
I need to remove the weapon sounds and add my own sounds to the server, how can I do this?

You can find the ids of the sounds with showsound 1, but first open the debug by debugscript 3 and you should setDevelopmentMode(true)
because these commands work when setDevelopmentMode is active

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