Jump to content

dxdraw


joedajoester

Recommended Posts

Posted

How would you make a picture or text appear somewhere on the map with dxdrawtext? Do you attach it or something?

Edit: getScreenFromWorldPosition(0,0,0)

Would this work? And would i need to check line of sight?

Posted
local distance = 70 
local screenSizeX, screenSizeY = guiGetScreenSize() 
local scale = 7 
local myImage = "mtalogo.png" 
local x, y, z = 0, 0, 5 
  
function renderImage() 
    local px, py, pz = getElementPosition ( localPlayer ) 
    local dist = getDistanceBetweenPoints3D ( px, py, pz, x, y, z ) 
    if (dist < distance and isLineOfSightClear( px, py, pz, x, y, z, true, false, false, false )) then 
        local screenX, screenY = getScreenFromWorldPosition ( x, y, z+0.5 ) 
        local scaled = screenSizeX * (1/(2*(dist+5))) *.85 
        local relX, relY = scaled * scale, scaled * scale 
        if ( screenX and screenY ) then 
            dxDrawImage( screenX, screenY, relX, relY, tostring(myImage) ) 
        end 
    end 
end 
addEventHandler( "onClientRender", root, renderImage ) 

Change: x, y, z to your 3D world coordinates.

Posted

Ok, I have no clue how to do text so i just use gimp and put text and remove the background. How would I attach it to a element like how the playername is attached to the player how would I do that or for a car? Thanks

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