Xwad Posted March 22, 2016 Posted March 22, 2016 Hi. im trying to remove all world objects. Its working but i want to save 7 objects. Is it possible to make that only these objects will be not removed? --10324 --10329 --10330 --10331 --10332 --10715 --10719 i use this code ( its removing all objects) for i=550,20000 do removeWorldModel(i,10000,0,0,0) end setOcclusionsEnabled(false)
Captain Cody Posted March 23, 2016 Posted March 23, 2016 if not worldmodel == 10324 or worldmodel == 10329 or worldmodel == 10330 or worldmodel == 10331 or worldmodel == 10332 or worldmodel == 10715 or worldmodel == 10719 then There is infact other ways of doing it, but this'll work for your needs.
KariiiM Posted March 23, 2016 Posted March 23, 2016 Codly's way is good but be sure the variable 'worldmodel' must be defined else the code won't work These objects are models so you have to define worldmodel with the function: getElementModel But, be sure this function require one argument
Captain Cody Posted March 23, 2016 Posted March 23, 2016 Sorry Instead of world model put i --Or use local worldmodel = i
Captain Cody Posted March 23, 2016 Posted March 23, 2016 for i=550,20000 do if not i== 10324 or i== 10329 or i== 10330 or i== 10331 or i== 10332 or i== 10715 or i== 10719 then removeWorldModel(i,10000,0,0,0) end end setOcclusionsEnabled(false)
KariiiM Posted March 23, 2016 Posted March 23, 2016 Or, try my code: local model = nil function removingModels() if not model == 10324 or model == 10329 or model == 10330 or model == 10331 or model == 10332 or model == 10715 or model == 10719 then for i=550,20000 do model = i removeWorldModel(i,10000,0,0,0) end end end removingModels() setOcclusionsEnabled(false) Note: I didn't see your last post @CodyL
Captain Cody Posted March 23, 2016 Posted March 23, 2016 Yours wouldn't work, model == the number it checked right before, so it would skip over the models you are trying to remove in favor of the ids 1 greater then the ones you want.
Moderators IIYAMA Posted March 23, 2016 Moderators Posted March 23, 2016 local ignoreObjects = { [10324]=true, [10329]=true, [10330]=true, [10331]=true, [10332]=true, [10715]=true, [10719]=true } for i=550,20000 do if not ignoreObjects[i] then removeWorldModel(i,10000,0,0,0) end end setOcclusionsEnabled(false)
Xwad Posted April 3, 2016 Author Posted April 3, 2016 now the problem is that i fall trought the objects:/ pls help.
pro-mos Posted April 3, 2016 Posted April 3, 2016 https://wiki.multitheftauto.com/wiki/Se ... onsEnabled
Xwad Posted May 5, 2016 Author Posted May 5, 2016 still not working! pls help!! i tried with false and true but its not working:/ i still fall throught. setOcclusionsEnabled(false) setOcclusionsEnabled(true)
Moderators IIYAMA Posted May 5, 2016 Moderators Posted May 5, 2016 Probably because the objects you removed took part in the collision of the floor. You will have to fix that with other objects. (make them invisible) That's the only advise I can give you.
Xwad Posted July 21, 2016 Author Posted July 21, 2016 now everythink is working expect one bug that makes me very angry!! when i start the script then every model is removing sucessfull. But when a player reconnect then he will see all the Occlusions of the models!!! Pls guys help me fix that!!
Tails Posted July 21, 2016 Posted July 21, 2016 now everythink is working expect one bug that makes me very angry!! when i start the script then every model is removing sucessfull. But when a player reconnect then he will see all the Occlusions of the models!!! Pls guys help me fix that!! Move the player out of sight of the objects then warp them back.
shaio Posted July 22, 2016 Posted July 22, 2016 Basic Code. addEventHandler("onResourceStart",getRootElement(),function() for _,obj in ipairs(getElementsByType("object")) do if (getElementModel(obj) == 10324) or (getElementModel(obj) == 10329) or (getElementModel(obj) == 10330) or (getElementModel(obj) == 10331) or (getElementModel(obj) == 10332) or (getElementModel(obj) == 10715) or (getElementModel(obj) == 10719) then return else removeWorldModel(obj) destroyElement(obj) setOcclusionsEnabled(false) end end end)
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