Single-file Crosshair plugin, which draws a five-dot crosshair on the HUD whose gap widens with the distance to what the player is aiming at.
The PreDrawCrosshair, AdjustCrosshairColor and AdjustCrosshairGap hooks can hide or restyle it; the plugin's
own implementations hide it when the enable_crosshair config is false and highlight nearby players and cw_item
entities.
Backported from the Flux project.
Summary
Hooks
information color when aiming at a nearby player or item.enable_crosshair config is false.Hooks
Implements hook AdjustCrosshairColor
Called to pick the crosshair color; uses the information color when aiming at a nearby player or item.
Parameters
- trace Map The local player's eye trace
- distance Number Distance from the player to the trace hit position
Returns
- Color The crosshair color within 600 units of a player or
cw_item, otherwise nil
Implements hook AdjustCrosshairGap
Called to pick the crosshair gap; keeps it at 8 when aiming at a nearby player or item.
Parameters
- trace Map The local player's eye trace
- distance Number Distance from the player to the trace hit position
Returns
- Number The gap in pixels within 600 units of a player or
cw_item, otherwise nil
Called when the HUD is painted; draws a five-dot crosshair whose gap widens with the aimed distance.
Nothing is drawn when the PreDrawCrosshair hook returns true. The AdjustCrosshairColor and
AdjustCrosshairGap hooks, called with the eye trace and its distance, can override the color and
the gap; the gap eases towards its target each frame.
Implements hook PreDrawCrosshair
Called before the crosshair is drawn; hides it when the enable_crosshair config is false.
Returns
- Boolean True to skip drawing the crosshair, otherwise nil