squar Posted February 10, 2013 Share Posted February 10, 2013 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... Link to comment
PaiN^ Posted February 10, 2013 Share Posted February 10, 2013 I don't know how to make that kind of script, But ican tell that you'res is wrong !! Link to comment
csiguusz Posted February 10, 2013 Share Posted February 10, 2013 You can insert your objects into a table, then to delete them all loop through that table, and delete the objects. Link to comment
MR.S3D Posted February 10, 2013 Share Posted February 10, 2013 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) 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