Tokio

[Help] How to create 3d dxtext and rectangle?

Recommended Posts

I want create a dxdraw rectangle and text on the map. But how to make this possible?

Share this post


Link to post

As That ??

 

local x,y,z = -3327, -2937.8000488281, 5
 
addEventHandler("onClientRender",getRootElement(),
function()
    local px,py,pz = getElementPosition(getLocalPlayer())
    local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz )
    if distance <= 50 then
        local sx,sy = getScreenFromWorldPosition ( x, y, z+0.95, 0.06 )
        if not sx then return end
        local scale = 0.1/(0.1 * (distance / 50))
        dxDrawText ( "Get Car", sx, sy - 5, sx, sy - 5, tocolor(255,255,255,255), math.min ( 0.4*

(50/distance)*1.4,4), "default-bold", "center", "bottom", false, false, false )
    end
end
)

 

Share this post


Link to post
41 minutes ago, Dimos7 said:

You copy the code from wiki? 

Yeah

Share this post


Link to post
On 5/27/2018 at 17:22, 50cent said:

But this ( https://wiki.multitheftauto.com/wiki/DxDrawRectangle3D ) does not working.. why?

The code must be insert to client side.

And try to insert below code into the script.

local dot = dxCreateTexture(1,1)
local white = tocolor(255,255,255,255)
function dxDrawRectangle3D(x,y,z,w,h,c,r,...)
        local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z
	return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, dot, h, c or white, ...)
end

 

Share this post


Link to post

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.