dxDraw3DText
Client : Function
Function Syntax :
dxDraw3DText
element dxDraw3DText( string text, int x, int y, int z , int scale = 2, string font = "default", int r = 255, int g = 255, int b = 255 )
Required Arguments
text : A string representing the text you wish to draw .
x, y, z : Three integers representing the world coordinates of where you want the text to be .
scale : An int representing the size of the font .
font : A string representing the font type, This CAN'T be a DX font element, It can ONLY be :
"default": Tahoma
"default-bold": Tahoma Bold
"clear": Verdana
"arial": Arial
"sans": Microsoft Sans Serif
"pricedown": Pricedown (GTA's theme text)
"bankgothic": Bank Gothic Medium
"diploma": Diploma Regular
"beckett": Beckett Regular
r, g, b : Three integers representing the RGB Color codes for the text .
Source Function :
local foont = {
[ "default" ],
[ "default-bold" ],
[ "clear" ],
[ "arial" ],
[ "sans"],
[ "pricedown" ],
[ "bankgothic" ],
[ "diploma" ],
[ "beckett" ]
}
function dxDraw3DText ( text, x, y, z, scale, r, g, b, font )
if tostring "text" and tonumber "x" and tonumber "y" and tonumber "z" and tonumber "scale" and tostring "font" and tonumber "r" and tonumber "b" and tonumber "g" and font == #foont then
local mX, mY, mZ = getElementPosition ( getLocalPlayer() )
local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 0, 0, 0 )
local cX, cY, cZ = getElementPosition ( marker )
if getDistanceBetweenPoints3D ( mX, mY, mZ, cX, cY, cZ ) < 40 then
local sx, sy = getScreenFromWorldPosition ( x, y, z )
dxDrawText( ""..text.."", sx, sy, _, _, tocolor( r, g, b ), scale, ""..font.."")
end
end
end
addEventHandler ( "onClientRender", root, dxDraw3DText )
Exmple | مثال
Client :
addCommandHandler("draw",
function ( )
local x, y, z = getElementPosition ( getLocalPlayer() )
dxDraw3DText( "Welcome ", x, y, z, 2, 255,0,0, "arial")
end
end
)