Jump to content

Problem with destroyElement


Pietass

Recommended Posts

Hello i got a problem with destroyElement in table. I can build dynamic objects, but I cant remove object.

table = {} 
i = 1 
  
function createobject (thePlayer, Cname, Aname1, Aname2) 
        if (Aname1 == "create") then     
            local x,y,z = getElementPosition(thePlayer) 
            table[i] = createObject (Aname2, x + 10, y, z + 2, 0, 0, 0)    
            i = i+1 
        else if (Aname1 == "delete") then 
            table[Aname2] = nil 
            [b]destroyElement (table[Aname2])[/b] 
        else 
            outputChatBox ("ERROR...") 
        end 
    end 
end 
  
addCommandHandler ("o", createobject) 
-- /o [create/delete] [value]  
  

destroyElement don't work

Link to comment
function createobject (thePlayer, Cname, Aname1, Aname2) 
        if (Aname1 == "create") then     
            local x,y,z = getElementPosition(thePlayer) 
            table[i] = createObject (Aname2, x + 10, y, z + 2, 0, 0, 0)    
            i = i+1 
        else if (Aname1 == "delete") then 
            destroyElement (table[Aname2]) 
(...) 

It still doesn't work.

Link to comment
  
function createobject (thePlayer, Cname, Aname1, Aname2) 
        if (Aname1 == "create") then     
            local x,y,z = getElementPosition(thePlayer) 
            table[i] = createObject (Aname2, x + 10, y, z + 2, 0, 0, 0)   
            i = i+1 
        else if (Aname1 == "delete") then 
            destroyElement (table[i]) 
(...) 
  

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