micheal1230 Posted June 6, 2012 Share Posted June 6, 2012 No Errors just you dont get the suitcase Client Side: -- Suitcase Script 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) end addEventHandler ( "suitcase", getRootElement(), case ) addEvent("removesuitcase", true) function removebriefcase(player) exports.bone_attach:detachElementFromBone(case) moveObject(case, 1 ,0 ,0 ,0) end addEventHandler ( "removesuitcase", getRootElement(), removebriefcase ) The Resource Bone_Attach Description On MTA Community attachElementToBone(element,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 ServerSide: -- Suitcase Commands addCommandHandler("suitcase", function() triggerClientEvent ( "suitcase", getRootElement(), case ) end ) addCommandHandler("removesuitcase", function() triggerClientEvent ( "removesuitcase", getRootElement(), removebriefcase ) end ) Link to comment
Jaysds1 Posted June 6, 2012 Share Posted June 6, 2012 ok, I've cut it down to size for you, 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
micheal1230 Posted June 6, 2012 Author Share Posted June 6, 2012 ok, I've cut it down to size for you,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) It only works for me now No one else can use it Link to comment
Jaysds1 Posted June 6, 2012 Share Posted June 6, 2012 actually, when the person types in the command the person could use it unless, you want to control everyone having the suitcase Link to comment
micheal1230 Posted June 6, 2012 Author Share Posted June 6, 2012 actually, when the person types in the command the person could use it Come on my server you try and do it no one else can do it only me for some reason Link to comment
Jaysds1 Posted June 6, 2012 Share Posted June 6, 2012 ok, be right there try this, Server: -- Suitcase Script addCommandHandler("suitcase",function(player) case = createObject(1210,0,0,0) --(object,attachto,bone,x,y,z,rx,ry,rz) setElementVisibleTo(case,root,true) exports.bone_attach:attachElementToBone(case,player,12,0,0.1,0.3,0,180,0) end) addCommandHandler("removesuitcase",function(player) if(isElementAttachedToBone(case))then exports.bone_attach:detachElementFromBone(case) moveObject(case, 1 ,0 ,0 ,0) end end) Link to comment
50p Posted June 7, 2012 Share Posted June 7, 2012 ok, be right theretry this, Server: -- Suitcase Script addCommandHandler("suitcase",function(player) case = createObject(1210,0,0,0) --(object,attachto,bone,x,y,z,rx,ry,rz) setElementVisibleTo(case,root,true) exports.bone_attach:attachElementToBone(case,player,12,0,0.1,0.3,0,180,0) end) addCommandHandler("removesuitcase",function(player) if(isElementAttachedToBone(case))then exports.bone_attach:detachElementFromBone(case) moveObject(case, 1 ,0 ,0 ,0) end end) isElementAttachedToBone is not an MTA function not it exists in your script. If it's an exported function, make sure it's called from correct resource. Link to comment
Jaysds1 Posted June 7, 2012 Share Posted June 7, 2012 Sorry, he added the exports on it in-game, the only problem he has now is removing the suitcase from the player/ped but the last person that used it can remove the suitcase but not the previous player/ped 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