Плагины и расширения для Metamod:Source и SourceMod. Их описание, инструкции по установке и ссылки на закачку.

ТЕМА: [INC] Colors

[INC] Colors 11 года 8 мес. назад #6665

  • TRiLLeR
  • TRiLLeR аватар
  • Не в сети
  • Подробнее
    • Сообщений:218
    • Спасибо получено:14
    • Репутация: -3
Colors
Функции для легкого управления цветом чата
Версия: 1.0.5

Описание:
Этот файл позволяет разработчикам легко управлять цветами шрифта чата в различных игровых модах, использовать теги цветов, использовать теги в файлах перевода и автоматически заменять цвета в моде, которые не поддерживают их (любой цвет, который не поддерживается, будет заменен на зеленый цвет).

Функции:
  1. CPrintToChat
  2. CPrintToChatAll
  3. CPrintToChatEx
  4. CPrintToChatAllEx
  5. CRemoveTags
  6. CSkipNextClient

Регулярные фунции:
/**
 * Prints a message to a specific client in the chat area.
 * Supports color tags.
 *
 * @param client      Client index.
 * @param szMessage   Message (formatting rules).
 * @return              No return
 * 
 * On error/Errors:   If the client is not connected an error will be thrown.
 */
stock CPrintToChat(client, const String:szMessage[], any:...)

/**
 * Prints a message to all clients in the chat area.
 * Supports color tags.
 *
 * @param client      Client index.
 * @param szMessage   Message (formatting rules)
 * @return              No return
 */
stock CPrintToChatAll(const String:szMessage[], any:...)
Tags: {default}, {green}, {yellow}, {lightgreen}, {red}, {blue}, {olive}.

Основные цвета: default, green (желтый в L4D), olive.
Командные цвета: lightgreen, red, blue.

Таблица цветов:

Примечания:
  • You can use only one team color (like lightgreen, red or blue) in the message.
  • In hl2dm colors are different for classic deathmatch and team deathmatch.
  • If some color is not supported by the mod it will be automatically replaced with green
  • You can use these functions instead of default SM function, they are supports formatting (%d, %s, %t, etc.)
  • Green color is yellow in L4D and yellow is green in all other games. You can use tag that you prefer.
  • There must be at least one player in each team for proper red and blue colors working. Otherwise these tags will be replaced with green.


Team color based functions:
/** 
 * Prints a message to a specific client in the chat area. 
 * Supports color tags and teamcolor tag. 
 * 
 * @param client      Client index. 
 * @param author      Author index whose color will be used for teamcolor tag. 
 * @param szMessage   Message (formatting rules). 
 * @return              No return 
 *  
 * On error/Errors:   If the client or author are not connected an error will 
 *                    be thrown. 
 */ 
stock CPrintToChatEx(client, author, const String:szMessage[], any:...) 

/** 
 * Prints a message to all clients in the chat area. 
 * Supports color tags and teamcolor tag. 
 * 
 * @param author      Author index whos color will be used for teamcolor tag. 
 * @param szMessage   Message (formatting rules). 
 * @return              No return 
 *  
 * On error/Errors:   If the author is not connected an error will 
 *                    be thrown. 
 */ 
stock CPrintToChatAllEx(author, const String:szMessage[], any:...)
Tags: {default}, {green}, {yellow}, {olive}, {teamcolor}.

Основные цвета: default, green (желтый в L4D), olive.
Командные цвета: based on author's team color.

Примечания:
  • Author index is any client index whose team color you want to be used for {teamcolor} tag
  • Tag {teamcolor} replaces {red}, {blue} and {lightgreen} tags
  • All notes for regular functions are used for these function too.

Другое:
/**
 * Removes color tags from the string.
 *
 * @param szMessage   String.
 * @param maxlength   Maximum length of the string buffer.
 * @return              No return
 */
stock CRemoveTags(String:szMessage[], maxlength)

/**
 * This function should only be used right in front of
 * CPrintToChatAll or CPrintToChatAllEx and it tells
 * to those funcions to skip specified client when printing
 * message to all clients. After message is printed client will
 * no more be skipped.
 * 
 * @param client   Client index
 * @return           No return
 */
stock CSkipNextClient(client)
FAQ

1. Как использовать цвет?
Просто пометьте текст тегом цвета
CPrintToChat(client, "This text is {green}green{default} and this is {red}red");
Что получится:

2. Можно ли использовать красный синий и зеленый цвет в одной строке?
Нет. Можно использовать только один цвет команды в строке. (Либо синий либо красный)

3. Какой формат работы функции?
Они работают точно так же, как по умолчанию SM функции (например, PrintToChat)
CPrintToChatAll("This number {green}%d{default} is green", 5);
Что получится:

4. Можно ли использовать цвета в файлах перевода?
Да, можно.
Пример:
"Phrases"
{
    "My phrase"
    {
        "en"            "My {green}phrase"
        "ru"            "Моя {green}фраза"
    }
}
В коде:
CPrintToChatAll("%t", "My phrase");
Что получается:

5. Как его установить?
Потожить colors.inc в папку sourcemod/scripting/include
Добавить в код:
#include <colors>
6. Можно ли использовать серый цвет?

Можно. Но для этого требуется хотябы один игрок в наблюдателях.

7. Почему иногда красный-синий цвета иногда показывает зеленым?

Должен быть хотя бы один игрок в каждой команде для надлежащего красного и синего цвета. В противном случае эти теги будут заменены на зеленый.

Оригинал
Источник

Это сообщение содержит прикрепленные файлы.
Пожалуйста, войдите или зарегистрируйтесь, чтобы увидеть их.

Администратор запретил публиковать записи гостям.

Быстрая авторизация

Поделиться с друзьями

Полезные ссылки

Последние сообщения

Топ-10 пользователей

Популярные профили Просмотров
Lynx 5233
Мистер Выдра 5101
neon 2783
✔iR 1612
Natasha Heide 1449
ky3mu4 1445
|K|I|P|I|S|H| 1276
Aztek 1255
davich 1189
makaveli 1091

Статистика форума

  • Всего пользователей: 6094
  • Последний: Cherniy plasch
  • Всего сообщений: 66.2к
  • Всего тем: 3407
  • Всего разделов: 6
  • Всего категорий: 39
  • Открыто сегодня: 0
  • Открыто вчера: 0
  • Всего ответов сегодня?: 0
  • Всего ответов вчера: 2
Время создания страницы: 0.272 секунд