samp.directory
← Scripts e bibliotecas

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.

Biblioteca★ 2atualizado mar. de 2021MITPawnsampctl
Abrir no GitHub

Instalar com o sampctl

sampctl package install ZanderOperator/ChatBreaker

Execute na pasta do seu projeto. O sampctl baixa o pacote e as dependências dele.

Depende de 2 pacotes

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.

Esta página é montada com o que o GitHub publica sobre o repositório. O samp.directory não hospeda o código. Avisar de um problema com esta página