Defines the server-side cw.hint library, which sends hint text to players and keeps the list of gameplay hints shown at random.

cw.hint:Send and cw.hint:SendCenter show a hint to one player, and cw.hint:Distribute sends a random registered hint to every player who wants hints. The file adds the framework's default hints.

Summary

Methods

Adds a hint to the list that cw.hint:Distribute picks from.
Sends a random hint to every player who wants to see hints.
Returns a hint by its identifier.
Get()server
Picks a random hint whose callback does not return false.
Removes a hint from the list.
Sends a hint to be shown at the top right of the screen.
Sends a hint to every player who has initialized.
Sends a hint to be shown in the center of the screen.
Sends a centered hint to every player who has initialized.

Methods

cw.hint:Add(name, text, Callback)

server gamemodes/catwork/gamemode/core/libraries/sv_hint.lua:27

Adds a hint to the list that cw.hint:Distribute picks from.

Adding a hint under an existing name replaces it.

cw.hint:Add('Recognise', '#Hints_Recognise', function(player)
  return config.Get('recognise_system'):Get()
end)

Parameters

  • name String Unique identifier of the hint
  • text String The hint text; may be a #Phrase language key
  • Callback Function optional, defaults to nil Called as Callback(player); return false to hide the hint. cw.hint:Get calls it without a player

See also

Sends a random hint to every player who wants to see hints.

Players must have initialized, have the cwShowHints client convar set to 1, not be viewing the starter hints, and pass the hint's callback. The hint is shown for 6 seconds. Does nothing if no hint is available.

See also

Returns a hint by its identifier.

Parameters

  • name String Identifier the hint was added under

Returns

  • Map The hint with text and Callback keys, or nil if there is none

Picks a random hint whose callback does not return false.

The callbacks are called without a player here. Returns nothing if no hint is available.

Returns

  • String The hint text
  • Function The hint's callback, or nil if it has none

Removes a hint from the list.

Parameters

  • name String Identifier the hint was added under

cw.hint:Send(player, text, delay, color, bNoSound, showDuplicated)

server gamemodes/catwork/gamemode/core/libraries/sv_hint.lua:114

Sends a hint to be shown at the top right of the screen.

The text is parsed with cw.core:ParseData and translated on the client.

Parameters

  • player Player The recipient, a list of players, or nil for everyone
  • text String The hint text; may be a #Phrase language key
  • delay Number Seconds the hint stays on screen
  • color Color optional, defaults to nil Text color, or the name of a cw.option color; defaults to white
  • bNoSound Any optional, defaults to nil nil plays the default blip, a string plays that sound file, anything else plays no sound
  • showDuplicated Boolean optional, defaults to nil Show the hint even if the same text is already on screen

See also

cw.hint:SendAll(text, delay, color)

server gamemodes/catwork/gamemode/core/libraries/sv_hint.lua:125

Sends a hint to every player who has initialized.

Parameters

  • text String The hint text; may be a #Phrase language key
  • delay Number Seconds the hint stays on screen
  • color Color optional, defaults to nil Text color, or the name of a cw.option color; defaults to white

See also

cw.hint:SendCenter(player, text, delay, color, bNoSound, showDuplicated)

server gamemodes/catwork/gamemode/core/libraries/sv_hint.lua:79

Sends a hint to be shown in the center of the screen.

The text is parsed with cw.core:ParseData and translated on the client.

Parameters

  • player Player The recipient, a list of players, or nil for everyone
  • text String The hint text; may be a #Phrase language key
  • delay Number Seconds the hint stays on screen
  • color Color optional, defaults to nil Text color, or the name of a cw.option color; defaults to white
  • bNoSound Any optional, defaults to nil nil plays the default blip, a string plays that sound file, anything else plays no sound
  • showDuplicated Boolean optional, defaults to nil Show the hint even if the same text is already on screen

See also

cw.hint:SendCenterAll(text, delay, color)

server gamemodes/catwork/gamemode/core/libraries/sv_hint.lua:95

Sends a centered hint to every player who has initialized.

Parameters

  • text String The hint text; may be a #Phrase language key
  • delay Number Seconds the hint stays on screen
  • color Color optional, defaults to nil Text color, or the name of a cw.option color; defaults to white

See also

Defined in