Jump to content

attachElements Problem


Overkillz

Recommended Posts

Hey dear community, today I started to read about attachElements, well, I would like to attach a Spoiler to my infernus, I've already got the .dff file but I couldn't do it.

function attachU ( source, commandName ) 
      local x, y, z = getElementPosition ( source ) 
      local aleron1 = engineLoadDFF ( "test.dff", 411 ) 
      local aleron = createElement ( aleron1, x, y, z + 3 ) 
      attachElements ( aleron, source, 0, 0, 5 ) 
end 
addCommandHandler ( "aleron", attachU ) 

DebugScript 3 drops me this message:

I hope you can help me, thanks for your time.

Regards.

Link to comment
Hey dear community, today I started to read about attachElements, well, I would like to attach a Spoiler to my infernus, I've already got the .dff file but I couldn't do it.
function attachU ( source, commandName ) 
      local x, y, z = getElementPosition ( source ) 
      local aleron1 = engineLoadDFF ( "test.dff", 411 ) 
      local aleron = createElement ( aleron1, x, y, z + 3 ) 
      attachElements ( aleron, source, 0, 0, 5 ) 
end 
addCommandHandler ( "aleron", attachU ) 

DebugScript 3 drops me this message:

I hope you can help me, thanks for your time.

Regards.

element createElement ( string elementType, [ string elementID = nil ] )

you need to use createObject if You Want To Attach like this ex :

function attachU ( plr, commandName ) 
      local x, y, z = getElementPosition ( plr ) 
      local aleron1 = engineLoadDFF ( "test.dff", 411 ) 
      local aleron = createObject ( 980, x, y, z + 3 ) 
      attachElements ( aleron, plr, 0, 0, 5 ) 
end 
addCommandHandler ( "aleron", attachU ) 
Edited by Guest
Link to comment

@#,+( _xiRoc[K]; > - it just add an object above my position. Im trying to attach my own element.

@myonlake - I didnt understand both answer, Im trying to implement the model "test.tff" which is a spoiler for a car. Well, are you telling me that i can't implement it ? Sorry, I didnt understand that part.

Link to comment
Your script is never going to work.

You need to replace an existing vehicle upgrade or attach an object with a replaced model and texture. It's not as simple as you thought it's going to be.

Actully it's simple, adding the spoiler to the car dff file

then hiding/showing it using

setVehicleComponentVisible 

With this method you'll even be able to change the spoiler color ingame

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