cw.option class
Defines the cw.option library, the schema-level options: keys, sounds and, on the client, interface colors and
fonts.
Schemas override them with cw.option:SetKey, cw.option:SetSound, cw.option:SetColor and cw.option:SetFont.
The file sets the defaults, such as name_cash, model_cash, format_cash, the menu names and the icon_data_
keys.
Summary
Methods
click or rollover sound.Methods
Returns a schema interface color.
Parameters
- name String Color name
Returns
- Color The color, or
nilif it is not set
Returns the font used for a part of the interface.
Parameters
- name String Font slot name
Returns
- String The font name, or
nilif it is not set
Returns a schema option.
Parameters
- key String Option name
- lowerValue Boolean optional, defaults to
nilLowercase the value when it is a String
Returns
- Any The option's value, or
nilif it is not set
See also
Returns the file path of a schema sound.
Parameters
- name String Sound name
Returns
- String The sound file path, or
nilif it is not set
Plays a schema sound.
On the client the sound plays for the local player; on the server it is sent to every player. Does nothing if the sound is not set.
Parameters
- name String Sound name
Sets a schema interface color.
Parameters
- name String Color name, such as
'panel_background' - color Color The color
Sets the font used for a part of the interface.
Parameters
- name String Font slot name, such as
'main_text' - font String Name of a font created with
surface.CreateFont
Sets a schema option.
Options hold schema-level settings such as menu names, cash formats, models and icons.
cw.option:SetKey('name_cash', '#HL2RP_CashName')
cw.option:SetKey('model_cash', 'models/props_lab/box01a.mdl')
Parameters
- key String Option name
- value Any New value
See also
Sets a schema sound, such as the menu click or rollover sound.
Parameters
- name String Sound name
- sound String Sound file path