Jump to content

help attach element's


K4stic

Recommended Posts

Hello all help me pls at this it's create the object but not attach it to player :/

object = {} 
  
addEvent("xxx", true) 
addEventHandler("xxx", root, 
function(model) 
    if isElement(object[source]) then 
        destroyElement(object[source]) 
    end 
    local x, y, z = getElementPosition( source ) 
    object[source] = createObject( model, x, y, z ) 
    exports.bone_attach:attachElementToBone(object[source], source, 0.025, -0.01, 0.815, 0, 0, 180) 
    --attachElements(object[source], source, 0.02, -0.01, 0.815, 0, 0, 180) 
end) 
  
addEventHandler("onPlayerQuit", root, 
function() 
    if isElement(object[source]) then 
        destroyElement(object[source]) 
    end 
end) 

Link to comment
object = {} 
  
  
addEvent("xxx", true) 
addEventHandler("xxx", root, 
function(model) 
    if isElement(object) then 
        destroyElement(object) 
    end 
    local x, y, z = getElementPosition( source ) 
    local object = createObject( model, x, y, z ) 
    exports.bone_attach:attachElementToBone(object, source, 0.025, -0.01, 0.815, 0, 0, 180) 
    attachElements(object, source, 0.02, -0.01, 0.815, 0, 0, 180) 
end) 
  
addEventHandler("onPlayerQuit", root, 
function() 
    if isElement(object) then 
        destroyElement(object) 
    end 
end) 

Link to comment
object = {} 
  
addEvent("xxx", true) 
addEventHandler("xxx", root, 
function(plr) 
if ( getElementType (plr) == "player" ) then 
    if isElement(object) then 
        destroyElement(object) 
    end 
    local x, y, z = getElementPosition(plr) 
    local object = createObject( model, x, y, z ) 
    attachElements(object,plr, 0.02, -0.01, 0.815, 0, 0, 180) 
end 
end 
) 
  
addEventHandler("onPlayerQuit", root, 
function() 
    if isElement(object) then 
        destroyElement(object) 
    end 
end 
) 

Link to comment
object = {} 
  
addEvent("xxx", true) 
addEventHandler("xxx", root, 
function() 
    if isElement(object) then 
        destroyElement(object) 
    end 
    local x, y, z = getElementPosition(source) 
    local object = createObject( id, x, y, z ) 
    exports.bone_attach:attachElementToBone(object, source, 0.025, -0.01, 0.815, 0, 0, 180) 
    attachElements(object,source, 0.02, -0.01, 0.815, 0, 0, 180) 
end 
) 
  
addEventHandler("onPlayerQuit", root, 
function() 
    if isElement(object) then 
        destroyElement(object) 
    end 
end 
) 

Link to comment
object = {} 
  
addEvent("xxx", true) 
addEventHandler("xxx", root, 
function() 
    if isElement(object) then 
        destroyElement(object) 
    end 
    local x, y, z = getElementPosition(source) 
    local object = createObject( id, x, y, z ) 
    exports.bone_attach:attachElementToBone(object, source, 0.025, -0.01, 0.815, 0, 0, 180) 
    attachElements(object,source, 0.02, -0.01, 0.815, 0, 0, 180) 
end 
) 
  
addEventHandler("onPlayerQuit", root, 
function() 
    if isElement(object) then 
        destroyElement(object) 
    end 
end 
) 

Have you noticed that object are table not element?

@SKIPPER, As Castro said you forgot the Bone ID.

Link to comment
object = {} 
  
addEvent("xxx", true) 
addEventHandler("xxx", root, 
function() 
    if isElement(object) then 
        destroyElement(object) 
    end 
    local x, y, z = getElementPosition(source) 
    local object = createObject( id, x, y, z ) 
    exports.bone_attach:attachElementToBone(object, source, 0.025, -0.01, 0.815, 0, 0, 180) 
    attachElements(object,source, 0.02, -0.01, 0.815, 0, 0, 180) 
end 
) 
  
addEventHandler("onPlayerQuit", root, 
function() 
    if isElement(object) then 
        destroyElement(object) 
    end 
end 
) 

Have you noticed that object are table not element?

@SKIPPER, As Castro said you forgot the Bone ID.

Sorry, i was on a hurry :? .

Link to comment

I don't know to what bone you want to attach it, so I put the first one ( head ).

object = { } 
  
addEvent ( "xxx", true ) 
addEventHandler ( "xxx", root, 
    function ( model ) 
        if isElement ( object [ source ] ) then 
            destroyElement ( object [ source ] ) 
        end 
        local x, y, z = getElementPosition ( source ) 
        object [ source ] = createObject ( model, x, y, z ) 
        exports.bone_attach:attachElementToBone ( object [ source ], source, 1, 0.025, -0.01, 0.815, 0, 0, 180 ) 
    end 
) 
  
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        if isElement ( object [ source ] ) then 
            destroyElement ( object [ source ] ) 
        end 
    end 
) 

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