Jump to content

[HELP] Why not working this code with isElementOnScreen() argument?


Turbesz

Recommended Posts

local startTime = getTickCount() 
function ColorMarker() 
    for _,v in pairs(getElementsByType("marker", root, true)) do 
        if getElementData(v,"rgb") == true and isElementOnScreen(v) then 
            local progress = math.fmod(getTickCount() - startTime, 10000) / 10000 
            local length = interpolateBetween(400, 0, 0, 700, 0, 0, progress, "Linear") 
            local r, g, b = wavelengthToRGBA(length) 
            setMarkerColor(v, r, g, b, 100) 
        end 
    end 
end 
addEventHandler("onClientPreRender", getRootElement(), ColorMarker) 

if i remove that argument, the script works fine. but i think without that can cause lag with many players.

there is no errors and warnings in debugscript, then what wrong? o.O 

Edited by Turbesz
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...