natives.setTextColour: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
(Created page with "{{ScriptItem |endpoint = client |games = iv |type = function |name = natives.setTextColour |parameters = int r, int g, int b, int a |parameter1 = int r Red component (0–255) |parameter2 = int g Green component (0–255) |parameter3 = int b Blue component (0–255) |parameter4 = int a Alpha component (0–255), controls opacity (0 = fully transparent, 255 = fully opaque) |usage = Sets the RGBA colour and opacity of text drawn on the screen |notes = - Must be called bef...")
 
(No difference)

Latest revision as of 12:19, 28 November 2025

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

void natives.setTextColour(int r, int g, int b, int a)

The natives.setTextColour function is used to Sets the RGBA colour and opacity of text drawn on the screen.

Parameters

1) int r Red component (0–255).
2) int g Green component (0–255).
3) int b Blue component (0–255).
4) int a Alpha component (0–255), controls opacity (0 = fully transparent, 255 = fully opaque).

Return

void This function doesn't return a value.

Notes

Examples

Example 1 - JavaScript:

addEventHandler("OnDrawnHUD", function() {

   // White text with 80% opacity
   natives.setTextScale(0.30, 0.30);
   natives.setTextFont(0);
   natives.setTextColour(255, 255, 255, 200);
   natives.displayTextWithLiteralString(new Vec2(0.05, 0.10), "STRING", "Text with opacity 200/255");

});

Compatibility

There isn't any compatibility information for this function.