samp.directory
← Scripts et bibliothèques

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.

Bibliothèque★ 2mis à jour mars 2021MITPawnsampctl
Ouvrir sur GitHub

Installer avec sampctl

sampctl package install ZanderOperator/ChatBreaker

Lance ceci dans le dossier de ton projet. sampctl télécharge le paquet et ce dont il dépend.

L’essayer dans le compilateur Pawn →

Ajoute ses fichiers include, avec les bibliothèques dont il dépend, au compilateur Pawn de ton navigateur, prêts à être inclus dans un script.

Dépend de 2 paquets

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.

Cette page est construite à partir de ce que GitHub publie sur le dépôt. samp.directory n’héberge pas le code. Signaler un problème avec cette fiche

ZanderOperator/ChatBreaker : Bibliothèque SA-MP | samp.directory