samp.directory
← Scripts y librerías

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.

Librería★ 2actualizado mar 2021MITPawnsampctl
Abrir en GitHub

Instalar con sampctl

sampctl package install ZanderOperator/ChatBreaker

Ejecútalo en la carpeta de tu proyecto. sampctl descarga el paquete y sus dependencias.

Depende de 2 paquetes

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 se genera con lo que GitHub publica sobre el repositorio. samp.directory no aloja el código. Informar de un problema con esta ficha