Jump to content

Attaching sound to a player


Piorun

Recommended Posts

Example

function attachsoundtoplayer()    
sound = playSound3D("test.mp3",0,0,0)              
attachElements(sound,getLocalPlayer(),0,0,0)                  
end  
    
setTimer(attachsoundtoplayer,100,1)      
  

Link to comment

create the sound for the local player, then use the clientside event onClientRender

this event is triggered every single frame, so inside the handler function get the local player's position and setElementPosition(sound, x,y,z) afterwards

the beauty of this is that the sound follows you everytime you move (every frame)

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