..:D&G:.. Posted April 19, 2015 Share Posted April 19, 2015 Hello guys, I am making a garage system where admins can create a CJ garage with a gate. Everything works fine but when an admin deletes a garage, the gate doesn't get deleted. Here is my delete bit: if (garageID) then local garageID = tonumber(garageID) local found = false for i, v in ipairs (getElementsByType("object")) do if (getElementModel(v) == 17950) or (getElementModel(v) == 17951) then local dbid = tonumber(getElementData(v, "dbid")) if (dbid == garageID) then destroyElement(v) outputChatBox("Garage with #ID ".. garageID .." has been deleted.", thePlayer, 0, 255, 0) found = true break end end end Any ideas guys? Thanks. Link to comment
ALw7sH Posted April 19, 2015 Share Posted April 19, 2015 when you create the garage give it element data with the door object element example: local garage = createObject(...) local Door = createObject(...) setElementData(garage,"Door",Door) then when you delete the garage object just get the door element from the element data that you have set and delete it, sorry if my english is not easy to understand because it's bad but hopeful you understand Link to comment
..:D&G:.. Posted April 19, 2015 Author Share Posted April 19, 2015 It worked! Thanks a lot! (Your english is fine btw ) 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