Tente isto (não foi testado) e tambem não sou o melhor scripter (ainda aprendendo )
addEventHandler( 'onClientResourceStart', resourceRoot,
function bindHoron(_,state,veh)
local veh = getPedOccupiedVehicle(localPlayer)
local x,y,z = getElementPosition(veh)
if isElement(veh) then
if ( state == "down" ) then
local sound = playSound3D ("som.mp3",x,y,z, true)
setSoundMaxDistance( uSound, 100 )
attachElements (sound,veh)
elseif ( state == "up" ) then
if isElement( sound ) then
stopSound( sound )
end
end
end
end
)
bindKey("7", "down", bindHoron)
bindKey("7", "up",bindHoron)
O que substitui:
sound = playSound3D ("som.mp3",x,y,z)
para
local sound = playSound3D ("som.mp3",x,y,z, true)
e
setSoundMinDistance(sound,1.0)
setSoundMaxDistance(sound, 100)
para
setSoundMaxDistance( uSound, 100 )
Também veja isto que pode o ajudar:
https://wiki.multitheftauto.com/wiki/PlaySound3D