[Include] zmessage - multi-line messages with whole words shifts.
#1

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:
    • The number of the lines
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
Reply
#2

Very impressed! The whole-word shifting is definitely makes this script a one-of-a-kind.
Reply
#3

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
Код HTML:
[tr][/tr]
tags
Reply
#4

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).
Reply
#5

Quote:
Originally Posted by OstGot
Посмотреть сообщение
There is. Just use
Код HTML:
[ttable][/ttable]
and
Код HTML:
[tr][/tr]
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.
Reply
#6

What exactly is this? I yet don't understand its usage..
Reply
#7

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.
Reply
#8

Nice include, but in the new line don't follow the colors inputted (HTML syntax).
Reply
#9

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.
Reply
#10

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;
}
Reply
#11

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.
Reply
#12

Took it. Very nice
Reply
#13

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:
    • The number of the lines
Reply
#14

You rock, thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)