zmessage - multi-line messages with whole words shifts. -
ZiGGi - 27.11.2016
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
Re: zmessage - multi-line messages with whole words shifts. -
Chaprnks - 24.12.2016
Very impressed! The whole-word shifting is definitely makes this script a one-of-a-kind.
Re: zmessage - multi-line messages with whole words shifts. -
OstGot - 24.12.2016
Quote:
Originally Posted by Chaprnks
Very impressed! The whole-word shifting is definitely makes this script a one-of-a-kind.
|
Honestly, I did it before, but ziggi's implementation is much better
Good work
P.s.
Quote:
Originally Posted by ZiGGi
List of all defines here (no table tag on this forum)
|
There is. Just use
Код HTML:
[ttable][/ttable]
and
tags
Re: zmessage - multi-line messages with whole words shifts. -
SickAttack - 24.12.2016
A lot more code than is needed imo.
-------------------------------------------
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).
Re: zmessage - multi-line messages with whole words shifts. -
ZiGGi - 24.12.2016
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.
Re: zmessage - multi-line messages with whole words shifts. -
Luicy. - 24.12.2016
What exactly is this? I yet don't understand its usage..
Re: zmessage - multi-line messages with whole words shifts. -
ZiGGi - 24.12.2016
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.
Re: zmessage - multi-line messages with whole words shifts. -
Unrea1 - 25.09.2017
Nice include, but in the new line don't follow the colors inputted (HTML syntax).
Re: zmessage - multi-line messages with whole words shifts. -
ZiGGi - 22.10.2017
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.
Re: zmessage - multi-line messages with whole words shifts. -
2Col - 01.12.2017
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;
}
Re: zmessage - multi-line messages with whole words shifts. -
ZiGGi - 02.12.2017
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.
Re: zmessage - multi-line messages with whole words shifts. -
Dayrion - 02.12.2017
Took it. Very nice
Re: zmessage - multi-line messages with whole words shifts. -
ZiGGi - 23.12.2017
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:
Re: zmessage - multi-line messages with whole words shifts. -
Infernux - 28.01.2018
You rock, thank you