Jump to content

Text on markers


Ivo1313

Recommended Posts

I need some help in my script, im using onClientRender and getScreenFomWorld position but the dxDrawText wont work! heres my program:

marker = createMarker(-662.33703613281,2365.9025878906,178.9553527832, "cylinder", 1.5, 0, 100, 100, 200)

function Texto()
	if(getDistanceBetweenPoints3D(0, 0, 4+.5, getElementPosition(getLocalPlayer()))) < 20 then
		local coords = {getScreenFromWorldPosition(-662.33703613281,2365.9025878906,178.9553527832)}
		if coords[1] and coords[2] then
			dxDrawText("CJ", coords[1], coords[2], coords[1], coords[2], tocolor(255,0,0,255), 10, "sans", "center", "center", false, false, false, false)
		end
	end
end
addEventHandler("onClientRender", root, Texto)

 

Link to comment

I believe this is what you're trying to do.
 

marker = createMarker(-662.33703613281,2365.9025878906,178.9553527832, "cylinder", 1.5, 0, 100, 100, 200)

function Texto()
    local x,y,z = getElementPosition(localPlayer)
    local distance = getDistanceBetweenPoints3D(-662.33703613281,2365.9025878906,178.9553527832,x,y,z)
    if distance < 20 then
        local sx,sy =  getScreenFromWorldPosition(-662.33703613281,2365.9025878906,178.9553527832)
        if sx and sy then
            local coords = {sx,sy}
            if coords[1] and coords[2] then
                dxDrawText("CJ", coords[1], coords[2], coords[1], coords[2], tocolor(255,0,0,255), 10, "sans", "center", "center", false, false, false, false)
            end
        end
    end
end
addEventHandler("onClientRender", root, Texto)

 

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