cw.icon classclient
Defines the client-side cw.icon library, the chat icons shown next to player names.
An icon is a material path and a callback that says which players it applies to; cw.icon:PlayerSet and
cw.icon:GroupSet register one for a Steam ID or a user group. cw.player:GetChatIcon picks the icon, preferring
player icons.
Summary
Methods
Methods
cw.icon:Add(uniqueID, path, callback, bIsPlayer)
client gamemodes/catwork/gamemode/core/libraries/cl_icon.lua:29Registers a chat icon shown next to the names of the players it applies to.
cw.player:GetChatIcon uses the first icon whose callback returns true, and
player icons take precedence over the others. Prints an error and does
nothing when an argument is missing.
cw.icon:Add('Donator', 'icon16/heart.png', function(player)
return player:IsUserGroup('donator') or player:IsUserGroup('vip')
end)
Parameters
- uniqueID String Unique ID of the icon
- path String Path of the icon material, such as
'icon16/star.png' - callback Function Called with a player; returns
trueif the icon applies to them - bIsPlayer Boolean optional, defaults to
nilWhether this is an icon for a specific player, which wins over group icons
See also
Returns every registered chat icon.
Returns
- Map<Map> Icon tables (
path,callback,isPlayer) keyed by unique ID
cw.icon:GroupSet(group, uniqueID, path)
client gamemodes/catwork/gamemode/core/libraries/cl_icon.lua:77Registers a chat icon for every member of a user group.
Parameters
- group String Name of the user group, such as
'admin' - uniqueID String Unique ID of the icon
- path String Path of the icon material
cw.icon:PlayerSet(steamID, uniqueID, path)
client gamemodes/catwork/gamemode/core/libraries/cl_icon.lua:65Registers a chat icon for a single player.
Parameters
- steamID String Steam ID of the player, as returned by
Player:SteamID - uniqueID String Unique ID of the icon
- path String Path of the icon material
Removes a chat icon.
Prints an error when uniqueID is missing.
Parameters
- uniqueID String Unique ID of the icon