Scripting/Client/Classes/Text3D_v0_2_9_r2

Draw3DText is a one-frame call you repeat every frame. Text3D is the persistent version: create it once, edit its properties whenever you like (the same way as a GUILabel), and it is drawn every frame until you Delete() it. Draw3DText keeps working unchanged. Up to 256 Text3D objects exist at once (the constructor returns null when full); they are removed when the script unloads.

PropertyTypeAccessDescription
ID / Validinteger / boolrSlot number; false once deleted.
TextstringrwUp to 255 characters. Inline [#RRGGBB] colour tags work.
Pos / X / Y / Ztable / floatrwWorld position (Pos reads and writes a {x,y,z} table or Vector).
Colour / TextColourColourrwText colour, a Colour(r, g, b, a) or a packed 0xAARRGGBB integer. Reads back as {r,g,b,a}.
Alphaintegerrw0-255, the alpha of the colour.
VisibleboolrwHide / show without deleting.
RadiusfloatrwVisibility distance in metres, 0 = unlimited.
Scale / ScaleX / ScaleYtable / floatrwGlyph size multiplier. Scale takes a VectorScreen or one number.
FontNamestringrwFont face: a font installed on the PC, or (0.5, PC and Android) a <font> file of the server by file name or family name. On Android only <font> files change the face. Empty = the chat font.
FontSizeintegerrwFont size in pixels (9-72 after scaling). Default = the chat font size.
FontTagsstringrwSpace or comma separated flags: noshadow (no black shadow), nofade (hard cut at Radius instead of a fade), fixedsize (no shrinking with distance; PC only).
CheckLOSboolrwWhen true the text is NOT drawn while a building, vehicle or object is between the camera and the text (a text painted on a wall within 0.75 m of the hit still shows; glass and fences do not block). Checked every 100 ms.
BlockedboolrResult of the last CheckLOS test.
DistancefloatrDistance from the local player.
shopSign <- Text3D("[#FFD040]Ammu-Nation", Vector(1000.1, -885.2, 18.0), 40.0);
shopSign.CheckLOS = true;          // hide it behind buildings
shopSign.FontSize = 20;
shopSign.FontTags = "noshadow nofade";

function onClientCommand(cmd, text)
{
    if (cmd == "sign") shopSign.Text = text;           // edit live
    if (cmd == "signoff") shopSign.Visible = false;
    if (cmd == "signdel") { shopSign.Delete(); }
}

Build menus and HUD elements with a handful of constructors. Positions use VectorScreen(x, y) and sizes ScreenSize(width, height) in pixels of the game window. Create an element, set its properties, then add it to the draw list with AddGUILayer. Children of a window use positions relative to the window and are drawn with it.

Methods and functions

Categories: Client classes