×
×

HatsChat2 Chatbox

A fully customisable Lua chatbox. Includes many improvements over the default chatbox.

Installation

To install, simply drop the addon into your garrysmod/addons/ folder. You may need to update your fastdl if you want to make use of the packaged custom fonts.

Features

  • Works in any gamemode.
  • Supports ALL chat messages.
  • Complete emote system.
  • Steam emoticon support.
  • Complete Chat Color system.
  • Colour Glow system.
  • Client-side font selection.
  • Chatbox position and size settings.
  • Complete text-wrapping functionality.
  • Themes system, to change the look of the entire chatbox.
  • Animated themes.
  • Persistent settings, you will keep your settings when you rejoin, or join another server with the same ConfigID.
  • In-built chat tags system, support for Wyozi Tag Editor if installed.
  • LineIcon system, also supports using the player or rank’s Steam avatars.
  • Hyperlink system. Paste a URL and people can click it and go! Also supports “named” links.
  • Complete advanced Copy+Paste support, including copying links, steamids, and complete lines.
  • Server Bar, allowing you to add a label and buttons for your server. Configuration coming to the settings window soon.
  • Restrictions for emotes and chat colours, allowing donor-only emotes or colours.
  • Built-in permissions for ULX, Evolve, Exsto, and Serverguard.
  • Easy to use Settings and Server Settings windows.
  • Sent messages history, so you can just hit up or down to scroll through your history and resend a message.
  • Chat messages from previous sessions are loaded when you rejoin the server, so you won’t lose your chat on map changes.

Addons listed here make use of HatsChat2 features or complement the HatsChat2. All are optional.

FAQ

How do I add custom Emoticons/ChatColours/LineIcons/ChatTags to the chatbox?

These options are all available via the Server Settings menu. Ensure your rank has the permission “HatsChatAdmin_Config”, then you will see an “Open Server settings” button at the bottom of the standard settings window.

Help! I can’t edit chat tags, or chat tags aren’t showing at all!

This is almost always caused by another conflicting addon. You can confirm this yourself by checking the default tags, if your default tags do not look like this (including changing color) then you have a conflict.

Known conflicts include:

  • “ULX Essentials” (not ULX itself) that adds a plain white “(superadmin)” tag. Removing tags from this addon will fix the issue.
  • “CustomCommands” that adds a red “[Super-admin]” tag. Removing tags from this addon will fix the issue.

If you have none of the conflicts listed above, you can check for conflicts yourself by entering the command “hatschat_debug 1” in console. This will print a trace for most messages shown in chat, which will allow you to easily identify conflicting addons. In sandbox, the default trace looks like this.

I sent a message and want to resend something similar, can I get my old message back?

Yes, just hit the Up or Down arrow keys to scroll through your chat history and re-send any previous messages.

I want to change the default settings when a player joins, is this possible?

Of course! If you have the appropriate permissions, you will see an extra button at the bottom of the settings window. Clicking this button will change the server’s default settings to your current settings. You must change the Server Config ID to do this. It’s recommended that the Server Config ID is something unique to your community, for example the community name.

How do I make a player’s name glow/change colour?

By default, anyone with the rank Owner, Coowner, or Leader, and any superadmins will have custom colours or glows. To add more ranks or specific SteamIDs, use the server settings menu.

How do I edit the chat filter?

The chat filter is controlled by the permission “HatsChat_IgnoreFilter” in your moderation system. The chatbox will filter the chat of everyone who does not have this permission. If you are using ULX, everyone has this permission by default.

More precise configuration is available in the Server Settings menu (See above). Filtered words are sorted into categories, and categories have the options to be forced on for all users (Ignoring the above permission) and to be time-limited for holiday phrases. By default there are four categories; a standard curses blacklist, a website pattern-matching example, and two example holiday categories.

How do I modify/disable the server bar (bar with buttons under chat)?

This can be modified in hatschat/cl_serverbar.lua. You can disable it at line 11. You can modify the text at line 47. You can modify or add buttons below line 47, I recommend you use the default buttons as a guide. These settings will soon be available via the server settings window.

I’m a coder, how do I add custom LineIcons/Emotes/Glowing colours to chat from my addon?

Currently the simplest way to do this is to simply add an additional table to chat.AddText() depending on what you want to add. You can have as many of these tables as you want.

  • LineIcons = { “LINEICON”,”some/material/path.png” }
  • Emotes = { “EMOTE”, mat=Material( “some/material/path.png” ), str=”EmoteLabel”, size={width,height}, matpath=”some/material/path.png” }
  • PlayerData = { “PLYDATA”, RestrictionsOnly=false, ply=SomePlayer, Nick=”Name”, SteamID=”STEAM_0:0:0″} — The chatbox treats the message like it was sent by this player. Nick and SteamId optional.
  • Color = { r=255,g=255,b=255,a=255, Glow=true, GlowTarget=Color(0,0,0) } — Note: This is a standard colour table from Color(), with an added Glow and optional GlowTarget key

Note that some other custom chatboxes (but not the default chatbox) might handle tables poorly or cause errors. It’s best to wrap your code in an if HatsChat then. Example Usage.

I want to make an addon compatible with HatsChat, what hooks are available?

All standard chat hooks will work as expected, but there are a few HatsChat-specific hooks you can use if required.

All hooks are clientside.

  • HatsChatPostLoad. Called immediately after HatsChat initializes.
  • HatsChatPlayerName Arguments: Player. Override a player’s name as it appears in the chatbox. Return String.
  • HatsChatPlayerColor Arguments: Player. Override a player’s name colour. Return Color.
  • HatsChatPlayerIcon Arguments: Player. Override a player’s LineIcon. Return Material.
  • HatsChatClientUpdate Arguments: Int (type). Called whenever the client receives a server settings update. Used internally to update server settings drop-down menus.

hatschat2-chatbox

Рейтинг
( Пока оценок нет )
Funtik/ автор статьи
Понравилась статья? Поделиться с друзьями:
Комментарии: 1
  1. Funtik (автор)

    Обновлено до версии 1.4.23

Добавить комментарий