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.
| Property | Type | Access | Description |
|---|---|---|---|
ID / Valid | integer / bool | r | Slot number; false once deleted. |
Text | string | rw | Up to 255 characters. Inline [#RRGGBB] colour tags work. |
Pos / X / Y / Z | table / float | rw | World position (Pos reads and writes a {x,y,z} table or Vector). |
Colour / TextColour | Colour | rw | Text colour, a Colour(r, g, b, a) or a packed 0xAARRGGBB integer. Reads back as {r,g,b,a}. |
Alpha | integer | rw | 0-255, the alpha of the colour. |
Visible | bool | rw | Hide / show without deleting. |
Radius | float | rw | Visibility distance in metres, 0 = unlimited. |
Scale / ScaleX / ScaleY | table / float | rw | Glyph size multiplier. Scale takes a VectorScreen or one number. |
FontName | string | rw | Font 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. |
FontSize | integer | rw | Font size in pixels (9-72 after scaling). Default = the chat font size. |
FontTags | string | rw | Space or comma separated flags: noshadow (no black shadow), nofade (hard cut at Radius instead of a fade), fixedsize (no shrinking with distance; PC only). |
CheckLOS | bool | rw | When 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. |
Blocked | bool | r | Result of the last CheckLOS test. |
Distance | float | r | Distance 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
- Text3D – Creates the text.
- text3d.Delete / text3d.Remove – Removes the text.
Categories: Client classes