cw.hint classserver
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
cw.hint:Distribute picks from.false.Methods
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
#Phraselanguage key - Callback Function optional, defaults to
nilCalled asCallback(player); returnfalseto hide the hint.cw.hint:Getcalls 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
textandCallbackkeys, ornilif 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
nilif 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:114Sends 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
nilfor everyone - text String The hint text; may be a
#Phraselanguage key - delay Number Seconds the hint stays on screen
- color Color optional, defaults to
nilText color, or the name of acw.optioncolor; defaults to white - bNoSound Any optional, defaults to
nilnilplays the default blip, a string plays that sound file, anything else plays no sound - showDuplicated Boolean optional, defaults to
nilShow 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:125Sends a hint to every player who has initialized.
Parameters
- text String The hint text; may be a
#Phraselanguage key - delay Number Seconds the hint stays on screen
- color Color optional, defaults to
nilText color, or the name of acw.optioncolor; defaults to white
See also
cw.hint:SendCenter(player, text, delay, color, bNoSound, showDuplicated)
server gamemodes/catwork/gamemode/core/libraries/sv_hint.lua:79Sends 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
nilfor everyone - text String The hint text; may be a
#Phraselanguage key - delay Number Seconds the hint stays on screen
- color Color optional, defaults to
nilText color, or the name of acw.optioncolor; defaults to white - bNoSound Any optional, defaults to
nilnilplays the default blip, a string plays that sound file, anything else plays no sound - showDuplicated Boolean optional, defaults to
nilShow 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:95Sends a centered hint to every player who has initialized.
Parameters
- text String The hint text; may be a
#Phraselanguage key - delay Number Seconds the hint stays on screen
- color Color optional, defaults to
nilText color, or the name of acw.optioncolor; defaults to white