Axel Posted July 14, 2012 Posted July 14, 2012 So i'm using the bone_attach ressource but i have a little issue, i attach objects to players, but when they quit the object remains in the air. I'v tried this it doesn't do nothing and no bug function destroyAttached () local attached = getAttachedElements(source) for i,v in ipairs (attached) do if exports.bone_attach:isElementAttachedToBone(v) then destroyElement(v) end end end addEventHandler("onPlayerQuit", getRootElement(),destroyAttached)
Tete omar Posted July 14, 2012 Posted July 14, 2012 try this function Axel() destroyElement ( your object ) -- the player's object end addEventHandler ("onPlayerQuit", getRootElement(), Axel)
DiSaMe Posted July 14, 2012 Posted July 14, 2012 getAttachedElements won't do the job because it's not an attachment done using attachElements. And the resource doesn't have the function to return elements attached to specific ped/player. The easiest solution would be setting object's parent to player using setElementParent and the object will be destroyed automatically when player quits.
Axel Posted July 14, 2012 Author Posted July 14, 2012 setElementParent(obj,source) won t work... the object still doesn t dissapear
TwiX! Posted July 14, 2012 Posted July 14, 2012 look how work https://wiki.multitheftauto.com/wiki/SetElementParent
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