natives.displayTextWithLiteralString: Difference between revisions
Jump to navigation
Jump to search
ChrisGame20 (talk | contribs) (Created page with "{{ScriptItem |endpoint = client |games = iv |type = function |name = natives.displayTextWithLiteralString |parameters = Vec2 position, string literal, string text |parameter1 = Vec2 position Normalized screen coordinates (0.0–1.0) where the text will be drawn |parameter2 = string literal Literal type for the text, usually "STRING" |parameter3 = string text The actual text content to display |usage = Draws a text string on the screen at the specified position using a li...") |
ChrisGame20 (talk | contribs) No edit summary |
||
| Line 5: | Line 5: | ||
|name = natives.displayTextWithLiteralString | |name = natives.displayTextWithLiteralString | ||
|parameters = Vec2 position, string literal, string text | |parameters = Vec2 position, string literal, string text | ||
|parameter1 = Vec2 position Normalized screen coordinates ( | |parameter1 = Vec2 position Normalized screen coordinates (X,Y) where the text will be drawn | ||
|parameter2 = string literal Literal type for the text, usually "STRING" | |parameter2 = string literal Literal type for the text, usually "STRING" | ||
|parameter3 = string text The actual text content to display | |parameter3 = string text The actual text content to display | ||
Latest revision as of 12:11, 28 November 2025
Function Client Only ![]()
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
- - Must be called inside a rendering event such as OnDrawnHUD so the text is drawn each frame- Use supporting natives like natives.setTextScale, natives.setTextColour, natives.setTextFont to style the text before calling- The literal is typically "STRING" for arbitrary text, but other literals may exist for predefined labels.
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.