Jump to content

[help]Image 3D fixed in map


#RooTs

Recommended Posts

I'm trying to put a distance to be displayed. someone please help me?

my initial script

local tx, ty, tz = 1955.03369, -1855.28638, 13.54688 
addEventHandler("onClientRender", root, function() 
  
    local x, y, z = getElementPosition(localPlayer) 
    local sx, sy = getScreenFromWorldPosition(tx, ty, tz) 
 dxDrawImage(sx, sy-50, 100, 100, "2.png") 
end) 

my final attempt and poorly organized

local tx, ty, tz = 1955.03369, -1855.28638, 13.54688 
  
addEventHandler("onClientRender", root, 
function() 
    local x, y, z = getElementPosition(getLocalPlayer()) 
                local cx, cy, cz, x, y, z, dist 
                local x, y, z = getElementPosition( player ) 
                local cx, cy, cz = getCameraMatrix( ) 
                dist = math.sqrt( ( cx - x ) ^ 2 + ( cy - y ) ^ 2 + ( cz - z ) ^ 2 ) 
    if dist < 20 then 
        if isLineOfSightClear( cx, cy, cz, x, y, z, true, false, false, true, false, false, false,localPlayer ) then 
                local x,y = getScreenFromWorldPosition( tx, ty, tz + 0.15 ) 
                if x then 
                dxDrawImage(x, y, 100, 100, "2.png", 0,0,0, tocolor(255, 255, 255, 150)) 
        end 
    end 
                end 
        
    end 
end) 

Link to comment
local tx, ty, tz = 1955.03369, -1855.28638, 13.54688 
local maximumDistance = 50 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local x, y, z = getElementPosition ( localPlayer )  
        local sx, sy = getScreenFromWorldPosition(tx, ty, tz) 
        if ( getDistanceBetweenPoints2D ( x, y, tx, ty ) <= maximumDistance ) then 
            dxDrawImage ( sx, sy-50, 100, 100, "2.png" ) 
        end 
    end 
) 

Link to comment
local tx, ty, tz = 1955.03369, -1855.28638, 13.54688 
local maximumDistance = 50 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local x, y, z = getElementPosition ( localPlayer )  
        local sx, sy = getScreenFromWorldPosition(tx, ty, tz) 
        if ( getDistanceBetweenPoints2D ( x, y, tx, ty ) <= maximumDistance ) then 
            dxDrawImage ( sx, sy-50, 100, 100, "2.png" ) 
        end 
    end 
) 

Thanks man, I'm learning a lot from you .. :D

Link to comment

I copy some your idea? hahahahaha, you are funny

Grab the wiki and use some functions almost no one uses, make something different. If you look at CIT, don't copy them. If you're looking at SAUR or SAS Network, don't copy them. Not even a few details, not even ideas. Make things your own, like you're raising your own child. Remember, the most successful servers, always bring new ideas, not copies of other servers.

Stop being stupid, he has said what you need to do, now do your part.

I think you should try to do something, besides came up with ideas from other servers, and expect other people to do everything for you.

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