Jump to content

image into a checkpoint.


Recommended Posts

Hi,

Try that code:

local sW, sH = guiGetScreenSize() 
  
local dir = "img.png" --Your image directory 
  
addEventHandler("onClientRender", root, 
function() 
    local i_w = 72 --Your image size (width) 
    local i_h = 60  --Your image size (height) 
    local i_ratio = i_w / i_h 
    local iscale_w = 1700 / sW 
    i_w = i_w / iscale_w 
    i_h = i_w / i_ratio 
    for i, v in ipairs(getElementsByType("marker")) do 
        local x, y, z = getElementPosition(v) 
        local cx, cy, cz = getCameraMatrix() 
        if isLineOfSightClear(cx, cy, cz, x, y, z, false, false, false, false, false, false, false, v) then 
            local dist = getDistanceBetweenPoints3D(cx, cy, cz, x, y, z) 
            if dist <= 20 then --If distance between player camera and marker is <= 20, then show image 
                local px, py = getScreenFromWorldPosition(x, y, z + 1, 0.06) 
                if px then 
                    dxDrawImage(px-i_w/2, py-sH/5, i_w, i_h, dir, 0, 0, 0, tocolor( 255, 255, 255, 255 )) 
                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...