K4stic Posted February 13, 2013 Share Posted February 13, 2013 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
iPrestege Posted February 13, 2013 Share Posted February 13, 2013 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
K4stic Posted February 13, 2013 Author Share Posted February 13, 2013 same not attach object to player and not use attach element's i wonna use the export as attach Link to comment
Vision Posted February 13, 2013 Share Posted February 13, 2013 attachElementToBone (element, ped, bone, x, y, z, rx, ry, rz) You forgot to set the Bone ID. Link to comment
iPrestege Posted February 13, 2013 Share Posted February 13, 2013 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
K4stic Posted February 13, 2013 Author Share Posted February 13, 2013 error at line 6 Link to comment
iPrestege Posted February 13, 2013 Share Posted February 13, 2013 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
TAPL Posted February 13, 2013 Share Posted February 13, 2013 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
iPrestege Posted February 13, 2013 Share Posted February 13, 2013 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
K4stic Posted February 13, 2013 Author Share Posted February 13, 2013 TAPL if you remember is the server side of hats who you help me fix so for what id you talk? Link to comment
Castillo Posted February 13, 2013 Share Posted February 13, 2013 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
K4stic Posted February 13, 2013 Author Share Posted February 13, 2013 Thx Solidsnake14/Castillo you first one who make it work's big Thx but say what you do? Link to comment
Castillo Posted February 13, 2013 Share Posted February 13, 2013 exports.bone_attach:attachElementToBone ( object [ source ], source, 1, 0.025, -0.01, 0.815, 0, 0, 180 ) I added the bone ID after "source". Link to comment
K4stic Posted February 13, 2013 Author Share Posted February 13, 2013 lol so easy and i not see it but realy thx you are best Link to comment
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