Skip to content

ax.elements

Client-side HUD element registry and default framework elements.

Documented functions: 20  ·  Realm: client

Functions


ax.elements:AddHookedTargetLines(context, entity)

Adds lines returned from the GetTargetIDLines hook to a context.

Realm: client

Parameters

Name Type Description
context table TargetID context from CreateTargetContext.
entity Entity Display entity.

Returns

  • table: context The same context for chaining.

Source: gamemode/framework/libraries/cl_elements.lua:384


ax.elements:AddTargetLine(context, text, color, data)

Adds one line to a TargetID context.

Realm: client

Parameters

Name Type Description
context table TargetID context from CreateTargetContext.
text string Text to draw. Empty text is ignored.
color Color\|nil Text color.
data table\|nil Optional overrides: font, maxWidth, bNoWrap.

Returns

  • table: context The same context for chaining.

Usage

ax.elements:AddTargetLine(context, "Locked", Color(200, 80, 80))

Source: gamemode/framework/libraries/cl_elements.lua:322


ax.elements:AddTargetLines(context, lines)

Adds multiple TargetID lines from simple tables.

Each line supports text, color, font, maxWidth, and bNoWrap.

Realm: client

Parameters

Name Type Description
context table TargetID context from CreateTargetContext.
lines table Array of line definitions.

Returns

  • table: context The same context for chaining.

Source: gamemode/framework/libraries/cl_elements.lua:345


ax.elements:CreateTargetContext(x, y, alpha, data)

Creates a simple TargetID line drawing context.

Modules and schemas can use this to add tooltip lines without managing fonts,

wrapping, shadows, alpha, or line counters manually.

Realm: client

Parameters

Name Type Description
x number Screen X.
y number Screen Y.
alpha number Current TargetID alpha.
data table\|nil Optional overrides: font, maxWidth, lineSpacing, lines.

Returns

  • table: context TargetID drawing context.

Source: gamemode/framework/libraries/cl_elements.lua:299


ax.elements:DrawTargetLines(context)

Draws all queued TargetID lines and returns the updated line count.

Realm: client

Parameters

Name Type Description
context table TargetID context from CreateTargetContext.

Returns

  • number: lineCount Final line count.

Source: gamemode/framework/libraries/cl_elements.lua:401


ax.elements:DrawText(text, font, x, y, color, alpha, shadowAlpha)

Draws centered text with a soft shadow.

Realm: client

Parameters

Name Type Description
text string Text to draw.
font string Font name.
x number Screen X.
y number Screen Y.
color Color Text color.
alpha number Text alpha.
shadowAlpha number Shadow alpha.

Source: gamemode/framework/libraries/cl_elements.lua:253


ax.elements:DrawWrappedLines(text, font, x, y, color, alpha, lineCount, maxWidth, lineSpacing)

Draws wrapped centered lines and returns the updated line count.

Realm: client

Parameters

Name Type Description
text string Text to wrap and draw.
font string Font name.
x number Screen X.
y number Starting Y.
color Color Text color.
alpha number Base alpha.
lineCount number Current line count.
maxWidth number Maximum wrapped width.
lineSpacing number Vertical line spacing.

Returns

  • number: lineCount Updated line count.

Source: gamemode/framework/libraries/cl_elements.lua:270


ax.elements:Get(uniqueID)

Gets a HUD element by identifier.

Realm: client

Parameters

Name Type Description
uniqueID string Element identifier.

Returns

  • table|nil: element The registered element.

Source: gamemode/framework/libraries/cl_elements.lua:82


ax.elements:GetAll()

Gets all registered HUD elements.

Realm: client

Returns

  • table: elements Registry table keyed by unique identifier.

Source: gamemode/framework/libraries/cl_elements.lua:89


ax.elements:GetDisplayEntity(entity)

Resolves the entity that should be used for display data.

Realm: client

Parameters

Name Type Description
entity Entity Traced entity.

Returns

  • Entity: entity Display entity.

Source: gamemode/framework/libraries/cl_elements.lua:176


ax.elements:GetEntityDisplayDescription(entity)

Gets the default description for a TargetID entity.

Realm: client

Parameters

Name Type Description
entity Entity Display entity.

Returns

  • string|nil: description Description text.

Source: gamemode/framework/libraries/cl_elements.lua:227


ax.elements:GetEntityDisplayText(entity)

Gets the default display text for an entity.

Realm: client

Parameters

Name Type Description
entity Entity Display entity.

Returns

  • string|nil: text Display text.
  • Color|nil: color Display color.
  • boolean|nil: bShouldFlash Whether the text should softly flash.

Source: gamemode/framework/libraries/cl_elements.lua:186


ax.elements:GetTargetTrace(client)

Builds the default interaction trace used by the TargetID element.

Realm: client

Parameters

Name Type Description
client Player Local player.

Returns

  • table: trace Hull trace result.

Source: gamemode/framework/libraries/cl_elements.lua:158


ax.elements:IsEnabled(element, context)

Returns whether an element is currently enabled.

Realm: client

Parameters

Name Type Description
element table Element definition.
context table Paint context.

Returns

  • boolean: bEnabled Whether the element should be considered for drawing.

Source: gamemode/framework/libraries/cl_elements.lua:110


ax.elements:PaintHUD()

Paints all registered HUD elements.

Realm: client

Source: gamemode/framework/libraries/cl_elements.lua:126


ax.elements:PaintTargetID(context)

Paints the default TargetID HUD element.

Realm: client

Parameters

Name Type Description
context table Paint context.

Source: gamemode/framework/libraries/cl_elements.lua:451


ax.elements:PaintTargetIDExtra(entity, x, y, alpha)

Draws default TargetID extra lines for descriptions and entity extras.

Realm: client

Parameters

Name Type Description
entity Entity Display entity.
x number Screen X.
y number Screen Y.
alpha number Current alpha.

Source: gamemode/framework/libraries/cl_elements.lua:427


ax.elements:Register(uniqueID, data)

Registers a HUD element.

Realm: client

Parameters

Name Type Description
uniqueID string Stable identifier for the element.
data table Element definition. Supports order, option, enabled, ShouldDraw, Think, Paint.

Returns

  • table|nil: element The registered element, or nil when invalid.

Source: gamemode/framework/libraries/cl_elements.lua:54


ax.elements:SetOrder(uniqueID, order)

Changes the draw order of a registered element.

Realm: client

Parameters

Name Type Description
uniqueID string Element identifier.
order number New draw order. Lower draws earlier.

Source: gamemode/framework/libraries/cl_elements.lua:97


ax.elements:Unregister(uniqueID)

Removes a HUD element from the registry.

Realm: client

Parameters

Name Type Description
uniqueID string Element identifier.

Source: gamemode/framework/libraries/cl_elements.lua:71