natives.displayTextWithLiteralString

From GTA Connected
Revision as of 12:11, 28 November 2025 by ChrisGame20 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

void natives.displayTextWithLiteralString(Vec2 position, string literal, string text)

The natives.displayTextWithLiteralString function is used to Draws a text string on the screen at the specified position using a literal identifier.

Parameters

1) Vec2 position Normalized screen coordinates (X,Y) where the text will be drawn.
2) string literal Literal type for the text, usually "STRING".
3) string text The actual text content to display.

Return

void This function doesn't return a value.

Notes

Examples

Example 1 - JavaScript:

addEventHandler("OnDrawnHUD", function() {

   // Configure text style
   natives.setTextScale(0.40, 0.40);
   natives.setTextFont(0);
   natives.setTextColour(255, 255, 255, 255);
   natives.setTextCentre(false);
   natives.setTextProportional(true);
   natives.setTextDropshadow(true, 0, 0, 0, 255);
   // Draw text at top-left corner
   natives.displayTextWithLiteralString(new Vec2(0.05, 0.10), "STRING", "Hi, text example");

});

Compatibility

There isn't any compatibility information for this function.