samp.directory
← Скрипты и библиотеки

ZanderOperator/ChatBreaker

Simple chat breaking library for San Andreas Multiplayer modification, written in PAWN. It never breaks mid-word, only on space, and supports passing of embedded colors.

Библиотека★ 2обновлён март 2021 г.MITPawnsampctl
Открыть на GitHub

Установка через sampctl

sampctl package install ZanderOperator/ChatBreaker

Выполните в папке проекта. sampctl скачает пакет и его зависимости.

Зависит от 2 пакетов

README.md

ChatBreaker

Installation

Simply install to your project:

sampctl package install ZanderOperator/ChatBreaker

Include in your code and begin using the library:

#include <ChatBreaker>

Usage

This library is fairly simple. It ALS hooks a function that basically filters through long strings, look for ' '(space) chars, and break the message in two line if string length is larger than LINE_BREAKING_LENGTH.

It implements this feature in two a_samp natives:

SendClientMessage(playerid, color, const string[]);
SendClientMessageToAll(color, const string[]);

Also, it supports passing embedded colors. For example: your string has 102 chars, embedded color starts at 60th char, and last space is on 86th char. Function will break/split that string on 86th character, add 3 dots on the place of space in the first line, and "pass" the embedded color at the start of the rest of the string with 3 dots on beginning of the string.

If there is no space in between 20 chars before the LINE_BREAK_LENGTH is reached, chat line simply won't break/split, and will be sent in its original, unbroken state.

Testing

To test, simply run the package:

sampctl package run

Example short SendClientMessage and long SendClientMessageToAll will be executed on OnPlayerConnect callback.

Страница собрана из того, что GitHub публикует о репозитории. samp.directory не хранит этот код. Сообщить о проблеме с этой записью