EngineResetModelLODDistance

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function resets the LOD distance for an object / model ID.

Syntax

bool engineResetModelLODDistance ( int model ) 

OOP Syntax Help! I don't understand this!

Method: Engine.resetModelLODDistance(...)


Required Arguments

  • model: The model / object ID number you want to reset the LOD distance of.

Returns

Returns true if the LOD distance was reset to default, or false if the model argument is incorrect, or the LOD distance hasn't been changed.

Example

Click to collapse [-]
Client

This code will reset all script spawned objects' LOD distances. It also implements a counter which will show how many objects have been affected by this script.

function resetLODs()
    local count = 0 -- We add a counter for debug message
    for ind, obj in ipairs(getElementsByType("object")) do
        -- Get model, and reset it's LOD distance
        local model = getElementModel(obj)
        engineResetModelLODDistance(model)
        -- Add one to counter
        count = count + 1
    end
    outputDebugString("Reset LOD model distance for "..count.." objects", 3)
end
addEventHandler("onClientResourceStart", resourceRoot, resetLODs) -- We run this only when this resource (re)starts

See Also