Graphics::drawRect

From RAGE Multiplayer Wiki

Draws a rectangle on the screen.
*The total number of rectangles to be drawn in one frame is apparently limited to 399.

Syntax

mp.game.graphics.drawRect(pos_x, pos_y, width, height, color_r, color_g, color_b, color_a);

Required Arguments

  • pos_x: float (0.0-1.0, 0.0 is the left edge of the screen, 1.0 is the right edge of the screen)
  • pos_y: float (0.0-1.0, 0.0 is the top edge of the screen, 1.0 is the bottom edge of the screen)
  • width: float (0.0-1.0, 1.0 means the whole screen width)
  • height: float (0.0-1.0, 1.0 means the whole screen height)
  • color_r: int
  • color_g: int
  • color_b: int
  • color_a: int (0-255, 0 means totally transparent, 255 means totally opaque)

Return value

  • Undefined

Example

Client-Side
mp.events.add('render', () => {
    if (condition) {
        mp.game.graphics.drawRect(0.35, 0.4, 0.3, 0.2, 215, 55, 55, 155);
    }
});

See also