Jump to content

3D text


Recommended Posts

Hi guys, im making staff texts, but i get some gay error. When i am moving ( Running, walking, jumping, etc..) it spams debugscript. But, if im standing still, it works perfect

Screen:

http://imageshack.us/a/img14/9074/mtasc ... 210724.png

Code:

function dxNameTags (  ) 
    for i, v in ipairs ( getElementsByType ( "player" ) ) do 
        if ( v ~= localPlayer ) then 
            local job = getElementData ( v, "Job" ) 
            if ( job == "New Staff" or job == "Trained Staff" or job == "Trusted Staff" or job == "High Staff" or job == "Full Staff" ) then 
                local x, y, z = getElementPosition ( localPlayer ) 
                local x2, y2, z2 = getElementPosition ( v ) 
                if ( type( x ) == "number" and type ( y ) == "number" and type ( z ) == "number" ) then 
                    if ( type ( x2 ) == "number" and type ( y2 ) == "number" and type ( z2 ) == "number" ) then 
                        local dist = getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 ) 
                        local defdd = 6 
                        if ( dist < 6 ) then 
                            local scx, scy = getScreenFromWorldPosition ( x2, y2, z2 + 1 ) 
                            if isLineOfSightClear ( x, y, z, x2, y2, z2, true, false, false, false ) then 
                                local scale = 2 * ( ( defdd - dist ) / defdd ) 
                                local level = getElementData ( v, "Job" ) 
                                exports["SRNJobs"]:dxDrawBorderedText( level, scx, scy, scx, scy, tocolor ( 255, 255, 0, 255 ), scale, "default-bold", "center", "center", false, false, false ) 
                            end 
                        end 
                    end 
                end 
            end 
        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...