SA-MP Forums Archive
[Include] zmessage - multi-line messages with whole words shifts. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] zmessage - multi-line messages with whole words shifts. (/showthread.php?tid=622844)



zmessage - multi-line messages with whole words shifts. - ZiGGi - 27.11.2016

zmessage
GitHub
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[])) 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
Код HTML:
[tr][/tr]
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
Код 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.


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[]))


Re: zmessage - multi-line messages with whole words shifts. - Infernux - 28.01.2018

You rock, thank you