Jump to content

Attach To Vehicle


aneco

Recommended Posts

now i created this but when i type i cant hear any sound from vehicle how can i fix this.

when i load this for server-side i get:attempt to cal global 'playsound' (a nil value)

when i load this for client-side no error and no music.

  
function playmusic ( source, commandName ) 
      local x, y, z = getElementPosition ( source ) --Get the players position 
      local sound = playSound3D("music.mp3") 
      attachElements ( music, source, 0, 0, 5 ) --attach music. 
end 
addCommandHandler ( "play", playmusic ) 
  
  

Link to comment
function playmusic ( commandName ) -- Client side commands doesn't has 'player' argument, you must use 'localPlayer'. 
    local x, y, z = getElementPosition ( localPlayer ) --Get the players position 
    local sound = playSound3D("music.mp3", x, y, z) -- You forgot about the sound position. 
    attachElements ( sound, localPlayer, 0, 0, 5 ) --attach music. 
end 
addCommandHandler ( "play", playmusic ) 

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