Jump to content

Attaching Elements


DrifTech

Recommended Posts

local attached = {}
 
function attachSoundTo(sound,element)
if isElement(sound) and isElement(element) then
       attached[sound]=element
return true
end
return false
end
 
function moveAttachedSoundsToElements()
for sound,element in pairs(attached) do
if isElement(sound) and isElement(element) then
setElementPosition(sound,getElementPosition(element))
else
           attached[sound]=nil
end
end
end
addEventHandler("onClientRender",getRootElement(),moveAttachedSoundsToElements)

Just a quick script. Not sure if there are any errors in it or anything, probably isn't the best solution either, but it should give you an idea on how to do it. ;)

Just use function attachSoundTo on your sound + vehicle and done.

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