RedM Natives

DRAW_RECT

Draws a rectangle on the screen.

Hash0x405224591DF02025
Runtime nameDrawRect
NamespaceGRAPHICS
SideClient
NameOfficial
Docs
Since build1207
GTA V hash0x3A618A217E5154F0

Signature

void DRAW_RECT(float x, float y, float width, float height, int red, int green, int blue, int alpha, BOOL p8, BOOL p9);

Parameters

NameTypeDescription
xfloat—
yfloat—
widthfloat—
heightfloat—
redint—
greenint—
blueint—
alphaint—
p8BOOL—
p9BOOL—

Returns void

Description

Draws a rectangle on the screen.

-x: The relative X point of the center of the rectangle. (0.0-1.0, 0.0 is the left edge of the screen, 1.0 is the right edge of the screen)

-y: The relative Y point of the center of the rectangle. (0.0-1.0, 0.0 is the top edge of the screen, 1.0 is the bottom edge of the screen)

-width: The relative width of the rectangle. (0.0-1.0, 1.0 means the whole screen width)

-height: The relative height of the rectangle. (0.0-1.0, 1.0 means the whole screen height)

-R: Red part of the color. (0-255)

-G: Green part of the color. (0-255)

-B: Blue part of the color. (0-255)

-A: Alpha part of the color. (0-255, 0 means totally transparent, 255 means totally opaque)

Usage

Lua
DrawRect(x, y, width, height, red, green, blue, alpha, p8, p9)

-- always works, by hash
Citizen.InvokeNative(0x405224591DF02025, x, y, width, height, red, green, blue, alpha, p8, p9)
JavaScript and C#
JavaScript
DrawRect(x, y, width, height, red, green, blue, alpha, p8, p9);

// by hash
Citizen.invokeNative('0x405224591DF02025', x + 0.0000001, y + 0.0000001, width + 0.0000001, height + 0.0000001, red, green, blue, alpha, p8, p9);
C#
Function.Call((Hash)0x405224591DF02025, x, y, width, height, red, green, blue, alpha, p8, p9);
  • Float parameters: Lua integers (10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write 10.0 or value + 0.0. The generated JS wrappers add 0.0000001 to non-zero floats for the same reason.

Sources

alloc8or RDR3 NativeDB

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.