GraphicsClient

drawRect

DRAW_RECT0x3A618A217E5154F0

The GTA V native DRAW_RECT of the GRAPHICS namespace, as LS:MP client scripts call it: the global function drawRect, in JavaScript and in Lua.

SignatureJavaScript
drawRect(
  x: number,
  y: number,
  width: number,
  height: number,
  r: number,
  g: number,
  b: number,
  a: number,
  p8: boolean
): void
SignatureLua
drawRect(
  x: number,
  y: number,
  width: number,
  height: number,
  r: integer,
  g: integer,
  b: integer,
  a: integer,
  p8: boolean
)

Usage

JavaScript
drawRect(x, y, width, height, r, g, b, a, p8);
Lua
drawRect(x, y, width, height, r, g, b, a, p8)

Parameters

ParameterTypeJavaScriptLua
xfloatnumbernumber
yfloatnumbernumber
widthfloatnumbernumber
heightfloatnumbernumber
rintnumberinteger
gintnumberinteger
bintnumberinteger
aintnumberinteger
p8BOOLbooleanboolean

Returns

Nothing. In JavaScript the call evaluates to undefined.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

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)

The total number of rectangles to be drawn in one frame is apparently limited to 399.

Reference

Namespace
Graphics GRAPHICS
In the game
void DRAW_RECT(float x, float y, float width, float height, int r, int g, int b, int a, BOOL p8)
Hash
0x3A618A217E5154F0

Open in the interactive natives reference