Jump to content

setWorldSoundEnabled and hydra engine sound


Recommended Posts

Greetings! 

Really need help with hydra/shamal/at400 engine sound ID for setWorldSoundEnabled. I manually went through IDs from 1 to 10000, but still couldn't disable the sound. However, when disabling 19 sound group at all (engines, horn, tires), the sound of jet planes is being disabled. Has anyone found a way to disable the required one without muting the entire indexes with "-1" index in function's arg? showsound does not detect this sound!

Edited by randymance
Link to comment
On 10/10/2024 at 00:55, randymance said:

Greetings! 

Really need help with hydra/shamal/at400 engine sound ID for setWorldSoundEnabled. I manually went through IDs from 1 to 10000, but still couldn't disable the sound. However, when disabling 19 sound group at all (engines, horn, tires), the sound of jet planes is being disabled. Has anyone found a way to disable the required one without muting the entire indexes with "-1" index in function's arg? showsound does not detect this sound!

hello, I will send you a server and client side code for a solution to your problem, check it and continue with these codes, I have not tested it, it will work but

 

server :

addEvent("disableJetSound", true)
addEventHandler("disableJetSound", root, function()
    triggerClientEvent(source, "disableJetSound", resourceRoot)
end)

client :
 

function disableHydraSound()
    for i = 10000, 15000 do
        setWorldSoundEnabled(i, false)
        outputChatBox("Sound ID: " .. i .. " disabled.")
    end
end

addEvent("disableJetSound", true)
addEventHandler("disableJetSound", root, disableHydraSound)

function checkHydraSound()
    local vehicle = getPedOccupiedVehicle(localPlayer)
    if vehicle and getElementModel(vehicle) == 520 then -- Hydra
        triggerServerEvent("disableJetSound", resourceRoot)
    end
end

addEventHandler("onClientVehicleEnter", root, checkHydraSound)

 

  • Like 1
Link to comment

Identify the Sound Groups

Check the documentation or forums for the specific sound group IDs for hydra, shamal, and at400. Engine sounds typically fall under specific IDs

https://wiki.multitheftauto.com/wiki/SetWorldSoundEnabled

Using setWorldSoundEnabled

 

-- Disable engine sounds for hydra, shamal, and at400
local aircraftSoundGroup = 19 -- Example sound group ID for engines
setWorldSoundEnabled(aircraftSoundGroup, false)

 

Test Different IDs

If the above ID does not work, try other sound group IDs that may be associated with aircraft sounds. You may need to experiment with IDs until you find the correct one.
Check Conflicting Scripts

Make sure that no other scripts are interfering with the sound settings. Disable other sound-related scripts temporarily to isolate the issue.

Edited by iNawaF
  • Like 1
Link to comment

Thank you all for your feedback. I think it's bugged, I use setWorldSoundEnabled( 19, false, true ) when the player boards the jet and turns the sound back on when leaving the vehicle. setWorldSoundEnabled with the last argument "immediate" disables the required sound at absolutely any specified index, but as soon as you leave the vehicle and get back in - the sound will play again.

Link to comment
6 hours ago, randymance said:

Thank you all for your feedback. I think it's bugged, I use setWorldSoundEnabled( 19, false, true ) when the player boards the jet and turns the sound back on when leaving the vehicle. setWorldSoundEnabled with the last argument "immediate" disables the required sound at absolutely any specified index, but as soon as you leave the vehicle and get back in - the sound will play again.

You will use an if statement with the setWorldSoundEnabled function to set it to false when the player enters a vehicle, and to true when the player exits the vehicle. You can define these conditions using an if statement.

The events for controlling entering and exiting vehicles are:
 

addEventHandler("onClientVehicleEnter", root, onVehicleEnter)  -- Listens for vehicle entry
addEventHandler("onClientVehicleExit", root, onVehicleExit)  -- Listens for vehicle exit

 

  • Like 1
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...