Jump to content

remove all objects expect 7 objects


Xwad

Recommended Posts

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) 

Link to comment

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

Link to comment
  • Moderators
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) 

Link to comment
  • 2 weeks later...
  • 1 month later...
  • Moderators

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.

Link to comment
  • 2 months later...

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

Link to comment
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.

Link to comment

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) 

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