addEventHandler("onClientVehicleEnter", getRootElement(),
function ()
local vehicle = getPedOccupiedVehicle ( localPlayer )
local x,y,z = getElementPosition( vehicle )
local collision = createColSphere ( x, y, z, 10.0 )
local playersincol = getElementsWithinColShape( collision, "player" )
sound = playSound3D( "music.mp3", x, y, z, true )
setSoundVolume( sound, 5 )
setSoundMaxDistance( sound, 20 )
attachElements ( sound, vehicle )
attachElements ( collision, vehicle )
end
)
addEventHandler("onClientVehicleExit", getRootElement(),
function(thePlayer, seat)
if thePlayer == getLocalPlayer() then
stopSound ( sound )
end
end
)
i want to all player hears the sound if close to vehicle