samp.directory
← Skrypty i biblioteki

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.

Biblioteka★ 2zaktualizowano mar 2021MITPawnsampctl
Otwórz na GitHubie

Zainstaluj za pomocą sampctl

sampctl package install ZanderOperator/ChatBreaker

Uruchom to w folderze swojego projektu. sampctl pobiera pakiet i to, od czego zależy.

Wypróbuj w kompilatorze Pawn →

Dodaje jej pliki include, razem z bibliotekami, od których zależy, do kompilatora Pawn w twojej przeglądarce, gotowe do dołączenia w skrypcie.

Zależy od 2 pakietów

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.

Ta strona jest zbudowana z tego, co GitHub publikuje o repozytorium. samp.directory nie hostuje kodu. Zgłoś problem z tym wpisem

ZanderOperator/ChatBreaker: Biblioteka SA-MP | samp.directory