Graphics::drawLine

From RAGE Multiplayer Wiki

Client-Side
Function

 JavaScript



JavaScript Syntax


Draws a line bewteen the 2 vectors, colors and alpha are between 0 and 255. Must be called every frame.

Required Params

  • x1: number
  • y1: number
  • z1: number
  • x2: number
  • y2: number
  • z2: number
  • red: number
  • green: number
  • blue: number
  • alpha: number

Return value

  • void

Syntax

mp.game.graphics.drawLine(x1, y1, z1, x2, y2, z2, red, green, blue, alpha)

Example

//draw a line from player's position to their forward looking position
mp.events.add('render', () => {
    const {x, y, z} = mp.players.local.getForwardVector()
    const {position} = mp.players.local;
    mp.game.graphics.drawLine(position.x, position.y, position.z, x, y, z, 255, 255, 255, 255);
});


See also