Jump to content

[HELP] Delete all objects function


squar

Recommended Posts

Posted
function createWorldObject ( thePlayer,objectID,objectPosX,objectPosY,objectPosZ) 
    local rx,ry,rz = getElementRotation ( source ) 
    obj = createObject(thePlayer,objectID,objectPosX,objectPosY,objectPosZ) 
    setElementRotation(obj,rx,ry,rz) 
end 
addEvent("createObject",true) 
addEventHandler("createObject",root,createWorldObject) 
  
function removeLastObject () 
        destroyElement(obj) 
end 
addEvent("onRemoveLast",true) 
addEventHandler("onRemoveLast",root,removeLastObject) 
  
function removeAllObjects () 
        destroyElement () 
end 
addEvent("onRemoveAll",true) 
addEventHandler("onRemoveAll",root,removeAllObjects) 

I'm not sure how I can make a remove All objects function. I was trying to remove all objects I have PLACED. It seemed to be a little bit complicated, and was wondering if any of you could have a look on it, and probably give a little hint about what to do.

This is server side, obviously...

Posted

I don't know how to make that kind of script, But ican tell that you'res is wrong !!

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

You can insert your objects into a table, then to delete them all loop through that table, and delete the objects.

Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003

Posted
  
  
function createWorldObject ( thePlayer,objectID,objectPosX,objectPosY,objectPosZ) 
    local rx,ry,rz = getElementRotation ( source ) 
    obj = createObject(thePlayer,objectID,objectPosX,objectPosY,objectPosZ) 
    setElementRotation(obj,rx,ry,rz) 
end 
addEvent("createObject",true) 
addEventHandler("createObject",root,createWorldObject) 
  
function removeLastObject () 
        destroyElement(obj) 
end 
addEvent("onRemoveLast",true) 
addEventHandler("onRemoveLast",root,removeLastObject) 
  
function removeAllObjects () 
    for k,v in ipairs(getElementsByType ( "object", getResourceRootElement(getThisResource()))) do 
          destroyElement (v) 
     end  
end 
addEvent("onRemoveAll",true) 
addEventHandler("onRemoveAll",root,removeAllObjects) 
  
  
  

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

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