Piorun Posted August 14, 2011 Posted August 14, 2011 How to attach a sound element to a player? I found this: https://wiki.multitheftauto.com/wiki/AttachElements, but this doesn't work for a sound element (i'm thinking that works few times ago).
Kenix Posted August 14, 2011 Posted August 14, 2011 Example function attachsoundtoplayer() sound = playSound3D("test.mp3",0,0,0) attachElements(sound,getLocalPlayer(),0,0,0) end setTimer(attachsoundtoplayer,100,1)
Piorun Posted August 15, 2011 Author Posted August 15, 2011 But in my first post i write that function "attachElements" doesn't works for a sound element .
BinSlayer1 Posted August 15, 2011 Posted August 15, 2011 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)
Piorun Posted August 16, 2011 Author Posted August 16, 2011 BinSlayer1 - yes, I know this functions, but i was thinking that is any other way to do this. Thanks.
Kenix Posted August 16, 2011 Posted August 16, 2011 Better use setTimer on 50 ms for update position.
BinSlayer1 Posted August 16, 2011 Posted August 16, 2011 ^ sometimez cpu intensive I suppose you are right, assuming you run Pentium II.
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