Posts: 1,659
Threads: 17
Joined: Sep 2008
27.11.2016, 10:15
(
Последний раз редактировалось ZiGGi; 23.12.2017 в 14:10.
)
zmessage
About
Multi-line messages with whole words shifts.
Usage
Just include it.
Functions
This library provides only one function with can be useful in
some cases. Some examples of usage can be found
here.
ZMsg_GetMessages(message[], array[][], const lines = sizeof(array), const line_size = sizeof(array[]))- Parameters:
- message[]: The original message which should be splitted.
- array[][]: The array which stores splitted strings.
- lines: The number of the strings which can be stored in array.
- line_size: The number of the symbols which can be stored in one array string.
- Return values:
Defines
Directive | Default value | Can be redefined | Note |
ZMSG_MAX_CHAT_LENGTH | MAX_CHATBUBBLE_LENGTH | yes | |
ZMSG_MAX_PLAYER_CHAT_LENGTH | (MAX_CHATBUBBLE_LENGTH / 2) | yes | |
ZMSG_SEPARATORS_LIST | ' ' | yes | Used in `case` statement |
ZMSG_HYPHEN_END | " ¬" | yes | |
ZMSG_HYPHEN_START | "» " | yes | |
Screenshot
Download
- GitHub download page:
https://github.com/Open-GTO/zmessage/releases
Posts: 603
Threads: 12
Joined: Sep 2007
Reputation:
0
Very impressed! The whole-word shifting is definitely makes this script a one-of-a-kind.
Posts: 1,659
Threads: 17
Joined: Sep 2008
Quote:
Originally Posted by OstGot
There is. Just use
Код HTML:
[ttable][/ttable]
and
tags
|
Wow, thank you.
Quote:
Originally Posted by SickAttack
A lot more code than is needed imo.
|
Where?
Quote:
Originally Posted by SickAttack
With this include you no longer have to worry about messages outputting incompletely (or in the worst case, not sending at all), as it separates a message in multiple lines/rows according to the last space found within a given length. If no space is found, it cuts the message at a specific number of characters.
https://github.com/Kevin-Reinke/Mess...tiple_rows.inc
P.S. There is no limit for the characters you can input in the function, like there is with SendClientMessage (which is 128).
|
As is in my include, but also you can set hyphen symbol, use packet strings and use standard sending messages functions.
Posts: 775
Threads: 78
Joined: Dec 2014
What exactly is this? I yet don't understand its usage..
Posts: 1,659
Threads: 17
Joined: Sep 2008
Quote:
Originally Posted by Luicy.
What exactly is this? I yet don't understand its usage..
|
For using SendClientMessage and another chat functions with messages of any length.
Posts: 824
Threads: 80
Joined: Oct 2013
Reputation:
0
Nice include, but in the new line don't follow the colors inputted (HTML syntax).
Posts: 1,659
Threads: 17
Joined: Sep 2008
Quote:
Originally Posted by Unrea1
Nice include, but in the new line don't follow the colors inputted (HTML syntax).
|
Fixed in 3.1.1.
Posts: 1,659
Threads: 17
Joined: Sep 2008
Quote:
Originally Posted by 2Col
Why does this code not work? It starts an infinite loop.
Код:
#define ZMSG_MAX_CHAT_LENGTH 64
#define ZMSG_MAX_PLAYER_CHAT_LENGTH 32
#include <zmessage>
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/yadayada", true) == 0) {
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT", name);
SendClientMessageToAll(0xC4C4C4FF, string);
return 1;
}
return 0;
}
|
Because it's a bug. Thank you for report. Fixed in 3.1.3.
Posts: 1,659
Threads: 17
Joined: Sep 2008
New version available!
Added
ZMsg_GetMessages function.
This function can be useful in
some cases. Some examples of usage can be found
here.
ZMsg_GetMessages(message[], array[][], const lines = sizeof(array), const line_size = sizeof(array[]))- Parameters:
- message[]: The original message which should be splitted.
- array[][]: The array which stores splitted strings.
- lines: The number of the strings which can be stored in array.
- line_size: The number of the symbols which can be stored in one array string.
- Return values: