Defines the client-side cw.bars library, the list of bars drawn at the top of the HUD.

The list is cleared and rebuilt every frame, so bars are added with cw.bars:Add from the GetBars hook.

Summary

Methods

Adds a bar to the list drawn at the top of the HUD.
Removes every top bar with a unique ID from the list.
Returns the top bar registered under a unique ID.

Methods

cw.bars:Add(uniqueID, color, text, value, maximum, flash, priority, maxValue, limitText)

client gamemodes/catwork/gamemode/core/libraries/cl_bars.lua:48

Adds a bar to the list drawn at the top of the HUD.

The list is cleared and rebuilt every frame, so call this from the GetBars hook rather than once. Bars with a higher priority are drawn first.

function PLUGIN:GetBars(bars)
  bars:Add('#Bars_Hunger', Color(100, 175, 175), '', hunger, 100, hunger < 10)
end

Parameters

  • uniqueID String Unique ID of the bar, usually a language phrase such as '#Bars_Health'
  • color Color Fill color of the bar
  • text String Text drawn in the middle of the bar; '' draws none
  • value Number Current value of the bar
  • maximum Number Value at which the bar is full
  • flash Boolean optional, defaults to nil Whether the bar pulses to draw attention
  • priority Number optional, defaults to 0 Sort priority; higher values are drawn first
  • maxValue Number optional, defaults to nil Current upper limit; when it is more than 5 below maximum, the rest of the bar is drawn as a limit marker
  • limitText String optional, defaults to nil Text, or a language phrase, drawn on the limit marker

See also

Removes every top bar with a unique ID from the list.

Parameters

  • uniqueID String Unique ID the bar was added with

See also

Returns the top bar registered under a unique ID.

Parameters

  • uniqueID String Unique ID the bar was added with

Returns

  • Map The bar's data table, or nil if no bar has that ID

See also

Defined in