Jump to content

bone_attach script from MTA Community


Recommended Posts

so you want make the example for player?

addCommandHandler("burger", 
function(player) 
burger = createObject(2880,0,0,0) 
exports.bone_attach:attachElementToBone(burger,player,12,0,0,0,0,-90,0) 
end) 

that what you want?

if not, explain better

Link to comment
so you want make the example for player?
addCommandHandler("burger", 
function(player) 
burger = createObject(2880,0,0,0) 
exports.bone_attach:attachElementToBone(burger,player,12,0,0,0,0,-90,0) 
end) 

that what you want?

if not, explain better

Ok lemme try this And Montiz I mean Like The Object Like A Suitcase did you use the resource?

Link to comment
No I never used this resource I just made a script not a whole resource.

Ok But Any Idea How To Destroy The Suitcase I Have Tryed destroyElement( case ) And DetachElementFromBone Or Whatever its called But It Doesnt Work.

attachElementToBone(element' date='ped,bone,x,y,z,rx,ry,rz) : attaches element to the bone of the ped. Server and client function.

element : Element which you want to attach.

ped : Ped or player which you want to attach element to.

bone : Bone which you want to attach element to.

x,y,z : Position offset from the bone.

rx,ry,rz : Rotation offset from the bone.

Returns true if element was successfully attached, false otherwise.

detachElementFromBone(element) : detaches element from the bone of the ped. Server and client function.

element : Element which you want to detach.

Returns true if element was successfully detached, false otherwise.

isElementAttachedToBone(element) : checks if element is attached to a bone. Server and client function.

element : Element which you want to check.

Returns true if element is attached to a bone, false otherwise.

getElementBoneAttachmentDetails(element) : gets ped, bone and offset of attached element. Server and client function.

element : Element which you want to get attachment details of.

Returns ped,bone,x,y,z,rx,ry,rz used in attachElementToBone if element is attached, false otherwise.

setElementBonePositionOffset(element,x,y,z) : changes position offset of attached element. Server and client function.

element : Element which you want to change offset of.

x,y,z : New position offset.

Returns true if position set successfully, false otherwise.

setElementBoneRotationOffset(element,rx,ry,rz) : changes rotation offset of attached element. Server and client function.

element : Element which you want to change offset of.

rx,ry,rz : New rotation offset.

Returns true if rotation set successfully, false otherwise.

getBonePositionAndRotation(ped,bone) : gets position and rotation of the ped bone. Client-only function.

Returns bone x,y,z position and rotation if ped is streamed in and bone number is valid, false otherwise.

Bone IDs:

1: head

2: neck

3: spine

4: pelvis

5: left clavicle

6: right clavicle

7: left shoulder

8: right shoulder

9: left elbow

10: right elbow

11: left hand

12: right hand

13: left hip

14: right hip

15: left knee

16: right knee

17: left ankle

18: right ankle

19: left foot

20: right foot

[/quote']

Link to comment

I made bone attachments resource and I don't understand what your problem is. detachElementFromBone only leaves element floating because the function does what and only what it says: detaches element from bone. What else do you expect?

Link to comment
I made bone attachments resource and I don't understand what your problem is. detachElementFromBone only leaves element floating because the function does what and only what it says: detaches element from bone. What else do you expect?

mate i mean i want to remove the element from the player so is disappears but only for that player everything i have done so far removes it from existent or removes it from everyone on the server

Link to comment
If you want the object to only be visible for some players, then make it client-side. Then object can be created and destroyed for one player without the same happening for another.

Mate is doesnt work

Clientside

-- Suitcase Script 
  
case = createObject(1210,0,0,0)    --(object,attachto,bone,x,y,z,rx,ry,rz) 
local case = createObject(1210,0,0,0)    --(object,attachto,bone,x,y,z,rx,ry,rz) 
  
  
addEvent("suitcase", true) 
function case(player) 
    exports.bone_attach:attachElementToBone(case,player,12,0,0.1,0.3,0,180,0) 
    case = createObject(1210,0,0,0)    --(object,attachto,bone,x,y,z,rx,ry,rz) 
end 
addEventHandler ( "suitcase", getRootElement(), case ) 
  
addEvent("removesuitcase", true) 
function removebriefcase(player) 
    case = createObject(1210,0,0,0)    --(object,attachto,bone,x,y,z,rx,ry,rz) 
    exports.bone_attach:detachElementFromBone(case) 
    moveObject(case, 1 ,0 ,0 ,0) 
end 
addEventHandler ( "removesuitcase", getRootElement(), removebriefcase ) 

Serverside

-- Suitcase Commands 
addCommandHandler("suitcase", 
function() 
    triggerClientEvent ( "suitcase", getRootElement(), case ) 
end 
) 
  
addCommandHandler("removesuitcase", 
function() 
    triggerClientEvent ( "removesuitcase", getRootElement(), removebriefcase ) 
end 
) 

Link to comment

You've made another topic, never mind, try this:

Client:

-- Suitcase Script 
case = createObject(1210,0,0,0)    --(object,attachto,bone,x,y,z,rx,ry,rz) 
addCommandHandler("suitcase",function() --local Player 
    exports.bone_attach:attachElementToBone(case,localPlayer,12,0,0.1,0.3,0,180,0) 
end) 
  
addCommandHandler("removesuitcase",function() 
    exports.bone_attach:detachElementFromBone(case) 
    moveObject(case, 1 ,0 ,0 ,0) 
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...