# dxDrawText

## Recommended Posts

Hey, i have a dude, how to draw a text on a 3D position on GTA World?

https://community.multitheftauto.com/in ... ls&id=7613

```dxDraw3DText = exports["3d_dx_texts"]:dxDraw3DText("text here",x,y,z)
```

Thanks!!

Here you go e.g:

```local x = -- x coordination
local y = -- y coordination
local z = -- z coordination

function()
local px,py,pz = getElementPosition(getLocalPlayer())
local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz )
if distance <= 150 then
local sx,sy = getScreenFromWorldPosition ( x, y, z+0.95, 0.06 )
if not sx then return end
local scale = 1/(0.3 * (distance / 150))
dxDrawText ( "XeroxMTA", sx, sy - 30, sx, sy - 30, tocolor(255,255,255,255), math.min ( 0.4*(150/distance)*1.4,4), "bankgothic", "center", "bottom", false, false, false )
end
end
)
```

Fixed, now i got a error on this , whats wrong?

```local Leaders =
{
[1] = { 0, 2934.3000488281, -2052.1000976563, 3.5, 179.252929 },
[2] = { 0, 2935.6999511719, -2052.1000976563, 3.5, 179.252929 },
[3] = { 0, 2937.1000976563, -2052.1000976563, 3.5, 179.252929 },
}
m1, x1, y1, z1, r1 = unpack ( Leaders[1] )
m2, x2, y2, z2, r2 = unpack ( Leaders[2] )
m3, x3, y3, z3, r3 = unpack ( Leaders[3] )

function CreateThePeds()
ped1 = createPed ( m1, x1, y1, z1, r1 )
ped2 = createPed ( m2, x2, y2, z2, r2 )
ped3 = createPed ( m3, x3, y3, z3, r3 )
end
```

```local Leaders =
{
{ 0, 2934.3000488281, -2052.1000976563, 3.5, 179.252929 },
{ 0, 2935.6999511719, -2052.1000976563, 3.5, 179.252929 },
{ 0, 2937.1000976563, -2052.1000976563, 3.5, 179.252929 }
}
m1, x1, y1, z1, r1 = unpack ( Leaders[1] )
m2, x2, y2, z2, r2 = unpack ( Leaders[2] )
m3, x3, y3, z3, r3 = unpack ( Leaders[3] )

function CreateThePeds()
ped1 = createPed ( m1, x1, y1, z1, r1 )
ped2 = createPed ( m2, x2, y2, z2, r2 )
ped3 = createPed ( m3, x3, y3, z3, r3 )
end
```

Thanks!!

## Create an account

Register a new account