aneco Posted March 19, 2012 Share Posted March 19, 2012 hello i created a playsound3d entity and now i want to attach it to special car but i cant find attachtocar command. here is code for playsound3d playSound3D("music.mp3", -2050.9133300781, 168.4600982666, 28.8359375, true) Link to comment
Castillo Posted March 19, 2012 Share Posted March 19, 2012 Because there's no such function: attachToCar, but there's attachElements. Link to comment
aneco Posted March 19, 2012 Author Share Posted March 19, 2012 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
Castillo Posted March 19, 2012 Share Posted March 19, 2012 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now