Yes it s possible here is the code
local g_screenX, g_screenY = guiGetScreenSize();
local gScale = 0.3;
local gAlphaDistance = 25;
local gMaxDistance = 50; -- Max Distance
local gTextAlpha = 120;
local gTextSize = 1;
local gAlphaDiff = gMaxDistance - gAlphaDistance;
gScale = 1 / gScale * 800 / g_screenY;
local gMaxScaleCurve = { { 0, 0 }, { 3, 3 }, { 13, 5 } };
local gTextScaleCurve = { { 0, 0.8 }, { 0.8, 1.2 }, { 99, 99 } };
local gTextAlphaCurve = { { 0, 0 }, { 25, 100 }, { 120, 190 }, { 255, 190 } };
---------------------
--Settings
--just edit those to change color text and postion
x = 0
y = 0
z = 0
r, g, b = 255, 0, 255
text = "Hello World"
-- //////////////////////////////////
-- // MATH FUNCTIONS //
-- //////////////////////////////////
function math.evalCurve( curve, input )
if input < curve[ 1 ][ 1 ] then
return curve[ 1 ][ 2 ];
end
for idx = 2, #curve do
if input < curve[ idx ][ 1 ] then
local x1 = curve[ idx - 1 ][ 1 ];
local y1 = curve[ idx - 1 ][ 2 ];
local x2 = curve[ idx ][ 1 ];
local y2 = curve[ idx ][ 2 ];
local alpha = ( input - x1 ) / ( x2 - x1 );
return math.lerp( y1, y2, alpha );
end
end
return curve[ #curve ][ 2 ];
end
function math.lerp( from, to, alpha )
return from + ( to-from ) * alpha;
end
addEventHandler ( "onClientRender", root,
function ( )
x = x
y = y
z = z
r = r
g = g
b = b
text = text
px, py, pz = getCameraMatrix();
distance_1 = getDistanceBetweenPoints3D( px, py, pz, x, y, z );
if distance_1 <= gMaxDistance then
local x_, y_ = getScreenFromWorldPosition( x, y, z + 0.95, 0.06 );
if x_ and y_ then
local scale = 1 / ( gScale * ( distance_1 / gMaxDistance ) );
local alpha = ( ( distance_1 - gAlphaDistance ) / gAlphaDiff );
alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha );
scale = math.evalCurve( gMaxScaleCurve, scale );
local textscale = math.evalCurve( gTextScaleCurve, scale );
local textalpha = math.evalCurve( gTextAlphaCurve, alpha );
dxDrawText( tostring(text), x_, y_, x_, y_, tocolor ( r, g, b, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true );
end
end
end
end
)