Crosshair draws a dynamic crosshair: a center dot with four bars whose gap widens with the distance to what the player is aiming at. It is hidden while the player is running or dead, and whenever the ShouldHUDPaint or ShouldHUDPaintCrosshair hook returns false. Plugins change its color and gap through the AdjustCrosshairColor and AdjustCrosshairGap hooks; the plugin itself uses them to tint and narrow the crosshair when the player aims at a nearby player or item.

Summary

Hooks

Tints the crosshair with the theme's accent color when the local player aims at a player or an item that is less than 600 units away.
Narrows the crosshair when the local player aims at a player or an item that is less than 600 units away.
Draws the crosshair: a center dot and four bars around it.
Hides the crosshair while the local player is running, dead or not yet initialized.

Hooks

PLUGIN:AdjustCrosshairColor(trace, distance)

client plugins/cl_crosshair.lua:82

Implements hook AdjustCrosshairColor

Tints the crosshair with the theme's accent color when the local player aims at a player or an item that is less than 600 units away.

Parameters

  • trace Map trace result of the local player's aim
  • distance Number distance from the local player to the trace hit position

Returns

  • Color the accent color, or nil to keep the default color

PLUGIN:AdjustCrosshairGap(trace, distance)

client plugins/cl_crosshair.lua:95

Implements hook AdjustCrosshairGap

Narrows the crosshair when the local player aims at a player or an item that is less than 600 units away.

Parameters

  • trace Map trace result of the local player's aim
  • distance Number distance from the local player to the trace hit position

Returns

  • Number a gap of 8, or nil to keep the distance-based gap

PLUGIN:HUDPaint()

client plugins/cl_crosshair.lua:30

Draws the crosshair: a center dot and four bars around it. Gap and color can be changed through the AdjustCrosshairGap and AdjustCrosshairColor hooks.

PLUGIN:ShouldHUDPaintCrosshair()

client plugins/cl_crosshair.lua:22

Implements hook ShouldHUDPaintCrosshair

Hides the crosshair while the local player is running, dead or not yet initialized.

Returns

  • Boolean false to hide the crosshair, nil otherwise

Defined in