GraphicsClient

drawLine

DRAW_LINE0x6B7256074AE34680

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

SignatureJavaScript
drawLine(
  x1: number,
  y1: number,
  z1: number,
  x2: number,
  y2: number,
  z2: number,
  red: number,
  green: number,
  blue: number,
  alpha: number
): void
SignatureLua
drawLine(
  x1: number,
  y1: number,
  z1: number,
  x2: number,
  y2: number,
  z2: number,
  red: integer,
  green: integer,
  blue: integer,
  alpha: integer
)

Usage

JavaScript
drawLine(x1, y1, z1, x2, y2, z2, red, green, blue, alpha);
Lua
drawLine(x1, y1, z1, x2, y2, z2, red, green, blue, alpha)

Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.

JavaScript · with vectors
drawLine(pos1, pos2, red, green, blue, alpha);
Lua · with vectors
drawLine(pos1, pos2, red, green, blue, alpha)

Parameters

ParameterTypeJavaScriptLua
x1floatnumbernumber
y1floatnumbernumber
z1floatnumbernumber
x2floatnumbernumber
y2floatnumbernumber
z2floatnumbernumber
redintnumberinteger
greenintnumberinteger
blueintnumberinteger
alphaintnumberinteger

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 depth-tested line from one point to another.


x1, y1, z1 : Coordinates for the first point
x2, y2, z2 : Coordinates for the second point
r, g, b, alpha : Color with RGBA-Values
I recommend using a predefined function to call this.
[VB.NET]

Public Sub DrawLine(from As Vector3, [to] As Vector3, col As Color)
    [Function].Call(Hash.DRAW_LINE, from.X, from.Y, from.Z, [to].X, [to].Y, [to].Z, col.R, col.G, col.B, col.A)
End Sub

[C#]

public void DrawLine(Vector3 from, Vector3 to, Color col)
{
    Function.Call(Hash.DRAW_LINE, from.X, from.Y, from.Z, to.X, to.Y, to.Z, col.R, col.G, col.B, col.A);
}

Reference

Namespace
Graphics GRAPHICS
In the game
void DRAW_LINE(float x1, float y1, float z1, float x2, float y2, float z2, int red, int green, int blue, int alpha)
Hash
0x6B7256074AE34680

Open in the interactive natives reference