Jump to content

how i can do this ?


Paplo

Recommended Posts

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

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