Jump to content

[HELP] Sounds in MTA


BanNsS1

Recommended Posts

I've created a event to reproduce a sound when the player press a key staying in a vehicle.

It works but...

If the car is stopped (0km/h) the sound volume is so low. If the car velocity is 120km/h the sound is reproduced with the desired volume.

This is my code:

local soundlockint = false 
function sonidoBloqueoVehiculoInterior( vehicle ) 
  
        local x, y, z = getElementPosition(vehicle) 
        local int = getElementInterior(vehicle) 
        local dim = getElementDimension(vehicle) 
        local px, py, pz = getElementPosition(getLocalPlayer()) 
        if (getDistanceBetweenPoints3D(x, y, z, px, py, pz)<35) then 
            local soundlockint = playSound3D("sounds/puertas_vehiculo_interior.mp3", x, y, z, false) 
            setSoundMaxDistance(soundlockint, 10) 
            setElementDimension(soundlockint, dim) 
            setElementInterior(soundlockint, int) 
            setSoundVolume(soundlockint, 0.5) 
        end 
         
        if (isPedInVehicle(getLocalPlayer())) then 
            setSoundVolume(sound, 0.5) 
        end 
end 
addEvent("PlayLockOrUnlockInteriorSound", true) 
addEventHandler("PlayLockOrUnlockInteriorSound", getResourceRootElement(), sonidoBloqueoVehiculoInterior) 

¿Volume depending on the vehicle speed? ¿How to fix?

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