Jump to content

HELP destroyelement


Ronis

Recommended Posts

Hello, need little help with destroy element, someone can help me what's wrong, why function removeboxfromhands not working

function PutBoxOnHand() 
local pizza = createObject ( 1271, 0, 0, 0 ) 
exports.bone_attach:attachElementToBone(pizza,source,12,0.081,0.05,0.01,0,-70,0) 
end 
addEvent("PutBoxOnHand", true) 
addEventHandler("PutBoxOnHand", root, PutBoxOnHand) 
  
 function removeBoxFromHands () 
    if pizza[source] and isElement(pizza[source]) then 
    destroyElement(tank[source]) 
    pizza[source] = nil 
   end 
  end 
addEvent("removeBoxHands", true) 
addEventHandler("removeBoxHands", getRootElement(),removeBoxFromHands) 

Link to comment

Use the [/lua] tags next time.

 

pizza = {} 
  
function PutBoxOnHand() 
pizza[source] = createObject ( 1271, 0, 0, 0 ) 
exports.bone_attach:attachElementToBone(pizza[source],source,12,0.081,0.05,0.01,0,-70,0) 
end 
addEvent("PutBoxOnHand", true) 
addEventHandler("PutBoxOnHand", root, PutBoxOnHand) 
  
 function removeBoxFromHands () 
    if pizza[source] and isElement(pizza[source]) then 
    destroyElement(pizza[source]) 
    pizza[source] = nil 
   end 
  end 
addEvent("removeBoxHands", true) 
addEventHandler("removeBoxHands", getRootElement(),removeBoxFromHands) 

Link to comment
local pizza = {} 
function PutBoxOnHand() 
pizza[source] = createObject ( 1271, 0, 0, 0 ) 
exports.bone_attach:attachElementToBone(pizza[source],source,12,0.081,0.05,0.01,0,-70,0) 
end 
addEvent("PutBoxOnHand", true) 
addEventHandler("PutBoxOnHand", root, PutBoxOnHand) 
  
 function removeBoxFromHands () 
    if pizza[source] and isElement(pizza[source]) then 
    destroyElement(pizza[source]) 
    pizza[source] = nil 
   end 
  end 
addEvent("removeBoxHands", true) 
addEventHandler("removeBoxHands", getRootElement(),removeBoxFromHands) 

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