ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. dxDrawLine

Function

dxDrawLine

ClientDrawing (dx)Identical to MTA:SA

Draws a line between two screen points.

Syntax

bool dxDrawLine(float startX, float startY, float endX, float endY [, int color = tocolor(255, 255, 255), float width = 1, bool postGUI = false])

Arguments

startXfloat
Start X.
startYfloat
Start Y.
endXfloat
End X.
endYfloat
End Y.
colorint, optional = tocolor(255, 255, 255)
Colour.
widthfloat, optional = 1
Thickness.
postGUIbool, optional = false
Above GUI.

Returns

true if drawn.

Example

A crosshair in the middle of the screen.

local sw, sh = guiGetScreenSize()
addEventHandler("onClientRender", root, function()
    dxDrawLine(sw / 2 - 10, sh / 2, sw / 2 + 10, sh / 2, tocolor(255, 255, 255), 2)
    dxDrawLine(sw / 2, sh / 2 - 10, sw / 2, sh / 2 + 10, tocolor(255, 255, 255), 2)
end)

See also