Jump to content

Problem with moving an attached element


Homie3

Recommended Posts

Posted

Hey Ho,

I want to move the attached object "heli" with "setElementAttachedOffsets"...

When I type the command "hoch" it just disappears...

Please help me guys I tried everything. :?:

function boot ( player, command ) 
    local derspieler = ( player ) 
    local x, y, z = getElementPosition ( derspieler ) 
    boot1 = createVehicle(453, x + 30, y, z) 
    bahn = createObject(8171, x + 30, y, z) 
    bahn1 = createObject(8171, x + 30, y, z) 
    bahn2 = createObject(8171, x + 30, y, z) 
    heli = createObject(9241, x + 30, y, z) 
    setVehicleDamageProof(boot1, true) 
    attachElements ( bahn, boot1, 25, 0, 1, 0, 0, 0 ) 
    attachElements ( bahn1, boot1, -25, 0, 1, 0, 0, 0 ) 
    attachElements ( bahn2, boot1, 0, 0, 0.5, 0, 0, 0 ) 
    attachElements ( heli, boot1, 0, -50, 0.5, 0, 0, 0 ) 
    local myBlib = createBlipAttachedTo ( boot1,  57 ) 
end 
  
addCommandHandler ( "boot", boot ) 
  
function nachOben ( player, command ) 
    local x, y, z = getElementPosition ( boot1 ) 
[color=#FF0000]    setElementAttachedOffsets (heli, x, y, 1)[/color] 
end 
  
addCommandHandler ( "hoch", nachOben ) 

Posted

Because you are attaching the heli to the boat at the boat itself the location, so example, the boat is at 2000,20,10 it will attach the heli at that location at the boat, so 2000 steps away.

so:

local x, y, z = getElementPosition ( boot1 )

is wrong

Posted

Thanks for the fast reply!

But now when I'm changing the x, y or z position of the "heli" it's standing at the same position of the boat, everytime.

----------------------------------

Okay now i solved the Problem! :D

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