Jump to content

[Solved]


Newbie

Recommended Posts

Posted (edited)

Since MTA Race maps became very "cluttered" with useless objects like hipoly trees and ect. That causes lag / FPS drops for some players. About the idea, is is posibble to hide specified obejcts for player ?

Edited by Guest
Posted

setElementVisibleTo ( element theElement, element visibleTo, bool visible )

Replace theElement with object, replace visibleTo with root of players, remove bool visible with false.

Posted

Can someone show me an example of destroyElement, i never used this so far.

Thats what i got with setting LOD distance:

function lager(thePlayer) 
for i=600,800 do 
engineSetModelLODDistance(i, 1)   
end 
end 
addCommandHandler("antilag", lager) 

600 - 800 ID's Threes, some plants.

Setting Model Lods, isn't the best way.. Well its working fine, but i think i should better use destroyElement

Posted
    function AntiLag() 
    for _, v in ipairs ( getElementsByType ( "object", root, true ) ) do  
      local id = getElementModel ( v )  
      if ( id => 600 and <= 800) then  
       destroyElement(v) 
     end  
    end 
    end 

Posted

Try this it will destroy the object with model id 800

function haha(modelID) 
    local obj = getElementsByType("object") 
    for i,v in ipairs(obj) do 
        if (getElementModel(v) == modelID) then 
            destroyElement(v) 
        end 
    end 
end 
 haha(800) 

Posted

He wants to destroy objects from id 600 to 800.

Try now:

 function AntiLag() 
    for _, v in ipairs ( getElementsByType ( "object", root, true ) ) do 
      local id = getElementModel ( v ) 
      if ( id => 600 and id <= 800) then 
       destroyElement(v) 
     end 
    end 
    end 

Posted
function AntiLag() 
    for _, v in ipairs ( getElementsByType ( "object", root, true ) ) do 
      local id = getElementModel ( v ) 
      if ( id >= 600 and id <= 800) then 
       destroyElement(v) 
     end 
    end 
    end 

Try it.

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