local pedX, pedY, pedZ = 0, 0, 0
local maxDistance = 12 -- the distance showing 3dtext
addEventHandler ( "onClientRender", root,
function ( )
local pX, pY, pZ = getElementPosition ( localPlayer )
local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ )
if ( distance <= maxDistance ) then
local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ )
if ( x and y ) then
dxDrawText( "text", x, y, _, _, tocolor( 255, 255, 255, 2555 ), 2, "default", "center", "center" )
end
end
end
)
It should work, but I'm not sure, couse I was writing it kinda fast.